Export (0) Print
Expand All
Expand Minimize

GridView.PagerTemplate Property

Gets or sets the custom content for the pager row in a GridView control.

Namespace:  System.Web.UI.WebControls
Assembly:  System.Web (in System.Web.dll)

[<BrowsableAttribute(false)>]
[<TemplateContainerAttribute(typeof(GridViewRow))>]
[<PersistenceModeAttribute(PersistenceMode.InnerProperty)>]
abstract PagerTemplate : ITemplate with get, set
[<BrowsableAttribute(false)>]
[<TemplateContainerAttribute(typeof(GridViewRow))>]
[<PersistenceModeAttribute(PersistenceMode.InnerProperty)>]
override PagerTemplate : ITemplate with get, set
<asp:GridView>
	<PagerTemplate>ITemplate</PagerTemplate>
</asp:GridView>

Property Value

Type: System.Web.UI.ITemplate
A System.Web.UI.ITemplate that contains the custom content for the pager row. The default value is null, which indicates that this property is not set.

A pager row is displayed in a GridView control when the paging feature is enabled (when the AllowPaging property is set to true). The pager row contains the controls that allow the user to navigate to the different pages in the control. Instead of using the built-in pager row user interface (UI), you can define your own UI by using the PagerTemplate property.

NoteNote

When the PagerTemplate property is set, it overrides the built-in pager row UI.

To specify a custom template for the pager row, first place <PagerTemplate> tags between the opening and closing tags of the GridView control. You can then list the contents of the template between the opening and closing <PagerTemplate> tags. To control the appearance of the pager row, use the PagerStyle property.

Typically, button controls are added to the pager template to perform the paging operations. The GridView control performs a paging operation when a button control with its CommandName property set to "Page" is clicked. The button's CommandArgument property determines the type of paging operation to perform. The following table lists the command argument values supported by the GridView control.

CommandArgument value

Description

"Next"

Navigates to the next page.

"Prev"

Navigates to the previous page.

"First"

Navigates to the first page.

"Last"

Navigates to the last page.

Integer value

Navigates to the specified page number.

The following example demonstrates how to create a custom pager template that allows the user to navigate through a GridView control using a DropDownList control.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0, 2.0

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft