Version

Paging

The WebDataGrid™ control’s paging mechanism breaks data into pages reducing load time and increasing performance. The number of pages is determined by the page size and the total number of records from the data source. WebDataGrid retrieves new data for each page as your end-users navigate from page to page. Data is retrieved asynchronously by default, using AJAX.

Enabling Paging

  1. Bind WebDataGrid to a SqlDataSource component retrieving data from the Customers table. For more information on doing this, see Binding WebDataGrid to a SQL Data Source.

  2. In the Microsoft® Visual Studio™ property window, locate the Behaviors property and click the ellipsis (…​) button to launch the Behaviors Editor Dialog.

  3. Check the CheckBox next to Paging from the list on the left to add and enable the behavior.

  4. In the properties, set PageSize to 10, increasing the number of records per page to 10\.

  5. Set PagerMode to NumericFirstLast which changes the pager links to numbers with links to the first and last pages.

WebDataGrid Enabling Paging 02.png
  1. Click Apply then Ok. You have enabled paging with the default settings.

The following markup is generated:

In HTML:

<Behaviors>
    <ig:Paging PagerMode="NumericFirstLast" PageSize="10">
    </ig:Paging>
</Behaviors>

To add paging from the code-behind, add the following code:

In Visual Basic:

WebDataGrid1.Behaviors.CreateBehavior(Of Infragistics.Web.UI.GridControls.Paging)()
WebDataGrid1.Behaviors.Paging.PageSize = 10
WebDataGrid1.Behaviors.Paging.PagerMode = Infragistics.Web.UI.GridControls.PagerMode.NumericFirstLast

In C#:

WebDataGrid1.Behaviors.CreateBehavior<Infragistics.Web.UI.GridControls.Paging>();
WebDataGrid1.Behaviors.Paging.PageSize = 10;
WebDataGrid1.Behaviors.Paging.PagerMode = Infragistics.Web.UI.GridControls.PagerMode.NumericFirstLast;
  1. In the property window, check that the EnableAjax property of WebDataGrid is set to True. If not, set it to True. WebDataGrid is ready to page data using AJAX.

WebDataGrid Enabling Paging 01.png