Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

DataGrid.AllowPaging Property

Gets or sets a value that indicates whether paging is enabled.

[Visual Basic]
Public Overridable Property AllowPaging As Boolean
[C#]
public virtual bool AllowPaging {get; set;}
[C++]
public: __property virtual bool get_AllowPaging();
public: __property virtual void set_AllowPaging(bool);
[JScript]
public function get AllowPaging() : Boolean;
public function set AllowPaging(Boolean);

Property Value

true if paging is enabled; otherwise, false. The default value is false.

Remarks

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.

Note   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.

Requirements

Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family

See Also

DataGrid Class | DataGrid Members | System.Web.UI.WebControls Namespace | PageIndexChanged | AllowCustomPaging | PageSize | CurrentPageIndex

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.