Class PagingControl
Paging of page lists.
Inheritance
Implements
Namespace: EPiServer.Web.WebControls
Assembly: EPiServer.Cms.AspNet.dll
Version: 11.20.7Syntax
public class PagingControl : Control, INamingContainer
Constructors
PagingControl()
Initializes a new instance of the PagingControl class.
Declaration
public PagingControl()
PagingControl(PageListData)
Initializes a new instance of the PagingControl class.
Declaration
public PagingControl(PageListData source)
Parameters
Type | Name | Description |
---|---|---|
PageListData | source | The source. |
Properties
AutoPaging
Defines whether paging should be turned on or off, depending on how many paging items are generated. If the value is true, paging is turned off when there is at most 1 paging item, that holds all pages. If the value is false, paging items are always shown, even if there is just one paging item that shows all pages, the paging items is displayed. By default the value is true, that is, show no more than needed.
Declaration
public virtual bool AutoPaging { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
CssClassPagingContainer
The CSS class that is used to format the container that holds the paging items. Default value is "PagingContainer".
Declaration
public virtual string CssClassPagingContainer { get; set; }
Property Value
Type | Description |
---|---|
System.String |
CssClassSelected
The CSS class that is used to format a selected paging item, by default "SelectedPagingItem".
Declaration
public virtual string CssClassSelected { get; set; }
Property Value
Type | Description |
---|---|
System.String |
CssClassUnselected
The CSS class that is used to format unselected paging items and the first/prev/next/last links. Default value is "UnselectedPagingItem".
Declaration
public virtual string CssClassUnselected { get; set; }
Property Value
Type | Description |
---|---|
System.String |
CurrentPagingItemCount
Number of paging items, based on total number of pages in pagelist.
Declaration
public virtual int CurrentPagingItemCount { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
CurrentPagingItemIndex
The current paging item index, used when paging has been turned on, during databind and between postbacks to track current paging item. The value is zero-bound (0 means first paging item, 1 is second paging item, and so on).
Declaration
public virtual int CurrentPagingItemIndex { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
FirstPagingItemText
The first paging item text, by default "«".
Declaration
public virtual string FirstPagingItemText { get; set; }
Property Value
Type | Description |
---|---|
System.String |
LastPagingItemText
The last paging item text, by default "»".
Declaration
public virtual string LastPagingItemText { get; set; }
Property Value
Type | Description |
---|---|
System.String |
LinkCounter
A counter used when generating the paging links.
Declaration
protected int LinkCounter { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
NextPagingItemText
The next paging item text, by default ">".
Declaration
public virtual string NextPagingItemText { get; set; }
Property Value
Type | Description |
---|---|
System.String |
PagesPerPagingItem
Number of pages that goes into one paging item, by default 7.
Declaration
public virtual int PagesPerPagingItem { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Examples
For example, if PagesPerPagingItem is 12, each paging item will list up to 12 pages.
PrevPagingItemText
The previous paging item text, by default "<".
Declaration
public virtual string PrevPagingItemText { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Source
Gets or sets the data source for the paging control.
Declaration
public virtual PageListData Source { get; set; }
Property Value
Type | Description |
---|---|
PageListData | The source. |
Methods
AddLinkSpacing()
Adds a span tag containing a white space
Declaration
protected virtual void AddLinkSpacing()
AddLinkSpacing(Boolean)
Adds a span tag containing a white space
Declaration
protected virtual void AddLinkSpacing(bool visible)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | visible | if set to |
AddSelectedPagingLink(Int32, String, String)
Create the currently active paging link and add it to the controls collection.
Declaration
protected virtual LinkButton AddSelectedPagingLink(int pagingIndex, string text, string altText)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | pagingIndex | Index of the paging link, 1 is first paging item, 2 second and so on. |
System.String | text | The text displayed in the paging link |
System.String | altText | Alternate text, displayed when hovering over link with mouse cursor |
Returns
Type | Description |
---|---|
System.Web.UI.WebControls.LinkButton | The paging link that was created |
AddUnselectedPagingLink(Int32, String, String, Boolean)
Create a paging link and add it to the controls collection.
Declaration
protected virtual LinkButton AddUnselectedPagingLink(int pagingIndex, string text, string altText, bool visible)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | pagingIndex | Index of the paging link, 1 is first paging item, 2 second and so on. |
System.String | text | The text displayed in the paging link |
System.String | altText | Alternate text, displayed when hovering over link with mouse cursor |
System.Boolean | visible | Indicates if link should be visible |
Returns
Type | Description |
---|---|
System.Web.UI.WebControls.LinkButton | The paging link that was created |
CreatePagingContainer()
Create the container control that holds the PagingControl including all paging items, called by the PagingControl's parent control. By default a Panel is created, where the CssClass is set to the value of the CssClassPagingContainer property.
Declaration
public virtual Control CreatePagingContainer()
Returns
Type | Description |
---|---|
System.Web.UI.Control | A control |
Remarks
The container control is added to the parent's Controls collection and the PagingControl is added to the container's Controls collection.
CreatePagingControls(PageDataCollection)
Create paging header, paging items and paging footer.
Declaration
public virtual void CreatePagingControls(PageDataCollection pages)
Parameters
Type | Name | Description |
---|---|---|
PageDataCollection | pages | Pages used to create paging items |
Remarks
The paging items creation task is delegated to the CreatePagingItems(PageDataCollection) method.
CreatePagingItems(PageDataCollection)
Create paging items.
Declaration
public virtual void CreatePagingItems(PageDataCollection pages)
Parameters
Type | Name | Description |
---|---|---|
PageDataCollection | pages | Pages used to create paging items |
Remarks
When overriding this method make sure to set LinkCounter = 0 in your method.
CreatePagingLink(Int32, String, String)
Creates a link button used for paging.
Declaration
protected virtual LinkButton CreatePagingLink(int pagingIndex, string text, string altText)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | pagingIndex | Index of the paging link, 1 is first paging item, 2 second and so on. |
System.String | text | The text displayed in the paging link |
System.String | altText | Alternate text, displayed when hovering over link with mouse cursor |
Returns
Type | Description |
---|---|
System.Web.UI.WebControls.LinkButton | The paging link |
PagingItemChanged(Object, CommandEventArgs)
Event handler to handle navigation in PagingControl
Declaration
public virtual void PagingItemChanged(object sender, CommandEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Object | sender | The sender. |
System.Web.UI.WebControls.CommandEventArgs | e | The System.Web.UI.WebControls.CommandEventArgs instance containing the event data. |
PreparePagingControls(PageDataCollection)
Prepares the paging control by trimming the page collection to what should be displayed according to CurrentPagingItemIndex.
Declaration
public virtual void PreparePagingControls(PageDataCollection pages)
Parameters
Type | Name | Description |
---|---|---|
PageDataCollection | pages | The page collection to trim |