We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

GridDataControl and DataPagerExt

I am currently using the GridDataControl to list data from the database, but the data is presented via a WCF mechanism that returns a given number of records each time.
With this in mind, having looked at the samples for DataPagerExt, none of them seems to match my requirement, as they appear to read all the data into memory, then page through this on request.
In the interests of using this myself, is there some way in which I can get hold of events issued when the page buttons are changed and control the paging in this way?
I've looked at PageIndexChanged and PageIndexChanging, but these seem to fire when changing the page of buttons, not when the actual buttons are clicked to trigger a grid page change.
I've also looked at using SfDataPager, but this seems to function in a very similar way to DataPagerExt.

1 Reply

DA Divya A Syncfusion Team October 15, 2013 03:56 AM UTC

Hi Alan,

We regret for the delay caused.

We can use OnDemandDataSourceLoad event of the DataPager. We can load the itemsSource to the grid OnDemand as required from this event. We have also prepared a sample based on your requirement and provided in the following location:

Code Snippet:

dataPager.OnDemandDataSourceLoad += new GridDataOnDemandPageLoadingEventHandler(dataPager_OnDemandDataSourceLoad);
void dataPager_OnDemandDataSourceLoad(object sender, GridDataOnDemandPageLoadingEventArgs e)
WpfApplication1.ServiceReference2.Service1Client dataContext = this.AssociatedObject.DataContext as WpfApplication1.ServiceReference2.Service1Client;
var param = new PageInfo(e.PagedRows, e.MaximumRows);
grid.ItemsSource = dataContext.OnDemandDataSourceLoad(param.StartIndex, param.EndIndex);

Sample: WcfServiceLibrary1.zip




Live Chat Icon For mobile
Up arrow icon