Gets or sets a value that indicates whether paging is enabled.
Assembly: System.Web (in System.Web.dll)
Paging allows you to display the contents of the DataGrid control in page segments. The number of items on a page is determined by the PageSize property. If no value is specified for the PageSize property, the DataGrid control will display 10 items on a page.
By default, paging is disabled. To enable paging, set this property to true and provide code to handle the PageIndexChanged event.
The typical logic for the PageIndexChanged event is to set the CurrentPageIndex property to the index of the page you want to display and then use the DataBind method to bind the data to the DataGrid control.
The event handler receives a DataGridPageChangedEventArgs object as a parameter. You can use the NewPageIndex property of this parameter to determine the index of the page selected by the user from the page selection elements of the DataGrid control.
With standard paging, the DataGrid control assumes that the data source contains all the items to be displayed. The DataGrid control calculates the indexes of the items on the displayed page based on the page index, specified by the CurrentPageIndex property, and the number of items of items on a page, specified by the PageSize property.
Normally, a data source that contains all items to be displayed is loaded every time the DataGrid control is paged. This can consume a lot of resources when the data source is very large. Custom paging allows you to load just the segment of data needed to display a single page. For additional information on custom paging, see the AllowCustomPaging property.