TemplatePagerField Class
Represents a DataPager field that enables you to create a custom paging UI.
Assembly: System.Web.Extensions (in System.Web.Extensions.dll)
Use the TemplatePagerField object to display navigation controls that enable users to page through data that is displayed by a control that implements the IPageableItemContainer interface. (An example is the ListView control.) You can also use the TemplatePagerField object to display information about the underlying data source, such as total number of records and the current page number.
The TemplatePagerField field has no built-in layout. Therefore, you must explicitly create the layout in the PagerTemplate template. You can format the content by using cascading style sheets (CSS) classes or inline style elements.
You can reference the DataPager control that contains the TemplatePagerField object by using the Container property. This is useful when you want to create binding expressions to show how many records were retrieved, the total number of pages, and similar information. These binding expressions can use properties of the DataPager control such as MaximumRows, PageSize, StartRowIndex, and TotalRowCount.
The TemplatePagerField field provides the PagerCommand event, which is typically used to perform a task when a button in the PagerTemplate template is clicked.
The following example shows how to add a TemplatePagerField field in a DataPager control. This example uses the TemplatePagerField to display the current page number, the total number of pages, and the total number of records. The DataPager control also contains two NextPreviousPagerField fields and a NumericPagerField field to display navigation controls that enable users to page through data.
The following example shows how to use the PagerCommand event to perform a different action depending on which button was clicked in a TemplatePagerField field. This example uses the TemplatePagerField to display navigation controls that enable users to page through data.
- AspNetHostingPermission
for operating in a hosted environment. Demand value: LinkDemand; Permission value: Minimal
- AspNetHostingPermission
for operating in a hosted environment. Demand value: InheritanceDemand; Permission value: Minimal
System.Web.UI.WebControls::DataPagerField
System.Web.UI.WebControls::TemplatePagerField
Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.