Collapse the table of content
Expand the table of content
Expand Minimize

GridView.AllowCustomPaging Property

.NET Framework 4.6 and 4.5

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

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

public virtual bool AllowCustomPaging { get; set; }

Property Value

Type: System.Boolean
true if custom paging is enabled; otherwise, false. The default is false.

Paging enables you to display the contents of the GridView control in chunks. The number of items on a page is determined by the PageSize property. Normally, every row in the data source is read every time the GridView control moves to a different page. This can consume a lot of resources when the total number of items in the data source is very large. Custom paging allows you to read just the items you need for a single page from the data source.

To enable custom paging, set both the AllowPaging and AllowCustomPaging properties to true. In a handler for the PageIndexChanging event, set the PageIndex property to the new page index value, set the VirtualItemCount property to the total number of items in the data source, set the data source to return only the rows needed for the current page, and call the DataBind method. The VirtualItemCount property enables the control to determine the total number of pages; this value is normally determined automatically by reading all of the items.

.NET Framework

Supported in: 4.6, 4.5
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2015 Microsoft