Using Telerik RadDataPager

RadDataPager is NOT dependent on the RadGridView, so it can be freely used together with any other ItemsControl.

You can page the data of your RadGridView via the Telerik RadDataPager. It provides a lot of features, so you can easily configure and manage the paging of the data. This topic will make you familiar with the following:

RadDataPager's Features

Here is a list of the most important features of the RadDataPager:

  • Binding to IEnumerable - the RadDataPager can bind to any collection that implements the IEnumerable interface, which means that it can page any collection. The RadDataPager wraps the collection internally in an IPagedCollectionView and exposes it through its PagedSource property. In order to page a collection you have to pass it to the Source property of the RadDataPager.

<telerik:RadDataPager Source="{Binding MyCollection}" /> 

IEnumerable data = new List<int>() { 1, 2, 3 }; 
RadDataPager radDataPager = new RadDataPager(); 
radDataPager.Source = data; 
Dim data As IEnumerable = New List(Of Integer)() 
Dim radDataPager As New RadDataPager() 
radDataPager.Source = data 
  • WCF RIA Services and DomainDataSource Support - the RadDataPager can be easily integrated with the DomainDataSource control and consume server data through the .NET RIA Services.

  • Telerik LINQ-based Data Engine - the RadDataPager uses the engine in order to achieve a server-side paging, when using web services.

  • Programmatic Paging - the developer is allowed to implement the paging programmatically, thanks to the API exposed by the RadDataPager.

  • MoveToFirstPage() - sets the RadDataPager to its first page.

  • MoveToLastPage() - sets the RadDataPager to its last page.

  • MoveToNextPage() - sets the RadDataPager to the next page.

  • MoveToPage( int pageIndex ) - sets the RadDataPager to a specific page.

  • MoveToPreviousPage() - sets the RadDataPager to the previous page.

  • CanChangePage - indicates whether paging is enabled.

  • CanMoveToFirstPage - indicates whether the user can move to the first page.

  • CanMoveToLasPage - indicates whether the user can move to the last page.

  • CanMoveToNextPage - indicates whether the user can move to the next page.

  • CanMoveToPreviousPage - indicates whether the user can move to the previous page.

  • Fixed Page Count- you are able to specify whether the count of the pages is fixed or not by setting the IsTotalItemCountFixed property. Its default value is False, which makes the paging endless. This means that the NextPage button will not be disabled when the pager goes to its last page. This is useful when having a dynamic collection of items and their count changes. If you know that items won't be added or removed from the collection, you can set the IsTotalItemCountFixed to True and have a fixed page count.

  • AutoEllipsis Modes - The AutoEllipsis appears when the PageCount is greater than the NumericButtonCount. You can specify where the AutoEllipsis is allowed to appear by setting the AutoEllipsisMode to one of the following values:

  • After - displays AutoEllipsis only after the Numeric Buttons.

  • Before - displays AutoEllipsis only before the Numeric Buttons.

  • Both - displays AutoEllipsis before and after the Numeric Buttons.

  • None - doesn't display AutoEllipsis.

  • Display Modes - by setting the DisplayMode property you can specify which of the Pager Buttons and Visuals to be visible.

Integrating RadDataPager with RadGridView

See this article for more information.

Using RadDataPager together with DomainDataSource

RadDataPager can be used together with DomainDataSource provided by the WCF RIA Services. Here is an example of RadGridView and RadDataPager bound to DomainDataSource.

<StackPanel> 
    <riaControls:DomainDataSource x:Name="domainDataSource" 
          AutoLoad="True" 
          QueryName="GetCustomers" 
          PageSize="10"> 
        <riaControls:DomainDataSource.DomainContext> 
            <local:NorthwindDomainContext /> 
        </riaControls:DomainDataSource.DomainContext> 
    </riaControls:DomainDataSource> 
    <telerik:RadGridView x:Name="radGridView" 
 ItemsSource="{Binding Data, ElementName=domainDataSource}" 
 IsBusy="{Binding IsBusy, ElementName=DomainDataSource1}" /> 
    <telerik:RadDataPager x:Name="radDataPager" 
  Source="{Binding Data, ElementName=domainDataSource}" 
  DisplayMode="FirstLastPreviousNextNumeric, Text" 
  IsTotalItemCountFixed="True" /> 
</StackPanel> 

See Also

In this article