New to Telerik UI for ASP.NET AJAX? Download free 30-day trial

Custom Paging

There are cases in which you may want to fetch only a fixed number of records and perform operations on this limited set of data. RadGrid allows such data manipulation through its integrated custom paging mechanism.

To use the custom paging mechanism:

  1. Set the grid or table view's AllowPaging and AllowCustomPaging properties to True.

  2. Set the table view's VirtualItemCount property to the total number of records that the grid can draw on. This allows the pager item to correctly represent the size of the pages you implement relative to the total number of records possible.

  3. Bind your grid using the NeedDataSource event. In the NeedDataSource event handler, implement code logic to extract the desired fixed number of records, based on the PageSize and CurrentPageIndex properties of the grid or table view.

PageSizeChanged event fires twice when AllowPaging is true for the RadGrid. To workaround this behaviour you should disable paging for the grid and enable it for the MasterTableView only.

When custom paging is enabled, the grid's default paging mechanism is disabled.

When you enable custom paging, RadGrid maintains the pager buttons, updating the pager item in response to user actions, and other presentation specifics. You need only provide the logic of fetching the desired set of records in the NeedDataSource event handler.

Another option for custom paging is possible when using declarative binding to an ObjectDataSource that supports its own paging mechanism.

For a live example that demonstrates custom paging, see Custom Paging.

In this article