Fork me on GitHub

UrlPager Class

Custom paging control for asp.net webform application, It supports url routing and paging through url parameter.

C# Syntax:

public class UrlPager:WebControl,INamingContainer

Properties:

NameDescription
AlwaysShowFirstLastPageNumberGets or sets a value indicating whether the first and the last numeric pager items should be displaye.
AutoHideGets or sets a value indicating whether UrlPager should be hidden if there's only one page of data.
ContainerTagGets or sets the HTML tag name for the container element of the pager.
CurrentPageIndexGets or sets the current page index.
CurrentPageNumberFormatStringGets or sets the format string for the current page number.
CurrentPagerItemTemplateGets or sets the html template to be applied to the current page pager item.
DisabledPagerItemTemplateGets or sets the html template to be applied to the disabled pager items.
EndItemIndexGets the index of the last data item that is displayed on the current page
FirstPageTextGets or sets the text displayed for the first page button.
InheritsRouteValuesGets or sets a value indicating whether UrlPager should inherit the route values from the current http context.
LastPageTextGets or sets the text displayed for the last page pager item.
MorePagerItemTemplateGets or sets the html template to be applied to the more pager items.
MorePageTextGets or sets the text displayed for the more pager items.
NavigationPagerItemTemplateGets or sets the html template to be applied to the first, previous, next and last page pager items.
NextPageTextGets or sets the text displayed for the next page pager item.
NumericPagerItemCountGets or sets the maximum number of the numeric pager items to be displayed.
NumericPagerItemTemplateGets or sets the html template for the numeric pager items.
PageIndexParameterNameGets or sets the page index parameter name in the current route.
PageNumberFormatStringGets or sets the format string for all numeric pager items.
PagerItemTemplateGets or sets the html template to be applied to all pager items.
PageSizeGets or sets the number of records that are displayed for each page of data.
PrevPageTextGets or sets the text displayed for the previous page pager item.
ReversePageIndexGets or sets a value indicating whether page index in the url should be reversed, that means the last page index will be 1 while the current page index is the total page number.
RouteNameGets or sets the name of the route that is used to generate paging urls.
RouteValuesThe route values to be applied to the route.
ShowDisabledPagerItemsGets or sets a value indicating whether the disabled pager items should be displayed.
ShowFirstLastGets or sets a value indicating whether the first page and the last page pager items should be displayed.
ShowMorePagerItemsGets or sets a value indicating whether the more pager items should be displayed.
ShowNumericPagerItemsGets or sets a value indicating whether the numeric pager items should be displayed.
ShowPrevNextGets or sets a value indicating whether the previous page and the next page pager items should be displayed.
StartItemIndexGets the index of the first data item that is displayed on the current page
TotalItemCountGets or sets the total number of records that are available for paging.
TotalPageCountGets the total number of pages.

Methods:

NameDescription
AddAttributesToRenderOverwrite the System.Web.UI.WebControls.WebControl.AddAttributesToRender method.
OnInitOverwrite the System.Web.UI.Control.OnInit method.
OnLoadOverwrite the System.Web.UI.Control.OnLoad method.
OnPageChangedRaises the PageChanged event.
OnPreRenderoverwrite the System.Web.UI.Control.OnPreRender method.
RenderBeginTagOverwrite the System.Web.UI.WebControls.WebControl.RenderBeginTag" method.
RenderContentsOverwrite the System.Web.UI.WebControls.WebControl.RenderContents method.
RenderEndTagOverwrite the System.Web.UI.WebControls.WebControl.RenderEndTag method.

Events:

NameDescription
PageChangedOccurs when one of the pager buttons is clicked, but after the control handles the paging operation.