System.Web.UI.WebControls Namespace GridView Class
.NET Framework version 2.0
Sets or retrieves a value specifying whether paging is enabled.
Inline |
<asp:gridview allowpaging = true | false ... > |
Script |
GridView.AllowPaging [ = true | false ] |
This property accepts or returns only a boolean value: true if paging is enabled; otherwise, false. Default value is false.
Instead of displaying all the records in the data source at the same time, the GridView control can automatically break the records up into pages. If the data source supports the paging capability, the GridView control can take advantage of that and provide built-in paging functionality. The paging feature can be used with any data source object that supports the ICollection interface or a data source that supports paging capability.
To enable the paging feature, set the AllowPaging property to true. By default, the GridView control displays 10 records on a page at a time. You can change the number of records displayed on a page by setting the PageSize property. To determine the total number of pages required to display the data source contents, use the PageCount property. You can determine the index of the currently displayed page by using the PageIndex property.
When paging is enabled, an additional row called the pager row is automatically displayed in the GridView control. The pager row contains controls that allow the user to navigate to the other pages. You can control the settings of the pager row ( such as the pager display mode, the number of page links to display at a time, and the pager control's text labels ) by using the PagerSettings property. The pager row can be displayed at the top, bottom, or both the top and bottom of the control by setting the Position property. You can also select from one of four built-in pager display modes by setting the Mode property.
The following example demonstrates how to set the AllowPaging property at design time to enable paging.
<asp:gridview id = "CustomersGridView" runat = "server"
datasourceid = "customers"
allowpaging
width=80% cellpadding=5
font-size = "8pt">
GridView Members PageIndex PageCount PageSize