TemplatePagerField Class
Represents a DataPager field that enables you to create a custom paging UI.
System.Web.UI.WebControls::DataPagerField
System.Web.UI.WebControls::TemplatePagerField
Assembly: System.Web.Extensions (in System.Web.Extensions.dll)
The TemplatePagerField type exposes the following members.
| Name | Description | |
|---|---|---|
![]() | DataPager | Gets a reference to the data pager that the DataPagerField object is associated with. (Inherited from DataPagerField.) |
![]() | IsTrackingViewState | Gets a value that indicates whether the DataPagerField object is tracking its view-state changes. (Inherited from DataPagerField.) |
![]() | PagerTemplate | Gets or sets the custom content for the pager field in a DataPager control. |
![]() | QueryStringHandled | Gets or sets a value that indicates whether the query string field has been evaluated. (Inherited from DataPagerField.) |
![]() | QueryStringValue | Gets the value of the query string field from the URL of the request. (Inherited from DataPagerField.) |
![]() | ViewState | Gets a dictionary of state information that enables you to save and restore the view state of a DataPagerField object across multiple requests for the same page. (Inherited from DataPagerField.) |
![]() | Visible | Gets or sets a value that indicates whether a data pager field is rendered. (Inherited from DataPagerField.) |
| Name | Description | |
|---|---|---|
![]() | CloneField | Infrastructure. Creates a copy of the current object that is derived from DataPagerField. (Inherited from DataPagerField.) |
![]() | CopyProperties | Copies the properties of the current TemplatePagerField object to the specified DataPagerField object. (Overrides DataPagerField::CopyProperties(DataPagerField).) |
![]() | CreateDataPagers | Creates the user interface (UI) controls for the pager field object and adds them to the specified container. (Overrides DataPagerField::CreateDataPagers(DataPagerFieldItem, Int32, Int32, Int32, Int32).) |
![]() | CreateField | Creates and returns a new instance of the TemplatePagerField class. (Overrides DataPagerField::CreateField().) |
![]() | Equals(Object) | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) |
![]() | Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) |
![]() | GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) |
![]() | GetQueryStringNavigateUrl | Creates a URL that contains a query string field that has the specified page number. (Inherited from DataPagerField.) |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() | HandleEvent | Handles events that occur in the TemplatePagerField object and performs the appropriate action. (Overrides DataPagerField::HandleEvent(CommandEventArgs).) |
![]() | LoadViewState | Restores view-state information that was saved previously. (Inherited from DataPagerField.) |
![]() | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() | OnFieldChanged | Raises the FieldChanged event. (Inherited from DataPagerField.) |
![]() | OnPagerCommand | Raises the PagerCommand event. |
![]() | SaveViewState | Saves the changes that were made to the DataPagerField object's view state. (Inherited from DataPagerField.) |
![]() | ToString | Returns a string that represents the current object. (Inherited from Object.) |
![]() | TrackViewState | Causes the DataPagerField object to track changes to its view state so that they can be stored in the control's ViewState property and persisted across requests for the same page. (Inherited from DataPagerField.) |
| Name | Description | |
|---|---|---|
![]() ![]() | IStateManager::IsTrackingViewState | Infrastructure. Gets a value that indicates whether the DataPagerField object is tracking its view-state changes. (Inherited from DataPagerField.) |
![]() ![]() | IStateManager::LoadViewState | Infrastructure. Restores view-state information that was saved previously. (Inherited from DataPagerField.) |
![]() ![]() | IStateManager::SaveViewState | Infrastructure. Saves the changes that were made to the DataPagerField object's view state. (Inherited from DataPagerField.) |
![]() ![]() | IStateManager::TrackViewState | Infrastructure. Causes the DataPagerField object to track changes to its view state so that they can be stored in the control's ViewState property and persisted across requests for the same page. (Inherited from DataPagerField.) |
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.
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.







