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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Is there a way to determine in which page of a paginated grid a record is?

Thread ID:





150596 Jan 13,2020 08:48 AM UTC Jan 14,2020 01:07 PM UTC WPF 1
Tags: SfDataGrid
Asked On January 13, 2020 08:48 AM UTC

I have a paginated SfDataGrid binded to a collection of records using SfDataPager.
I'd like, at runtime (by code), to move to a particular page where a particular record is displayed.
Is there a method to determine by code in which page number a particular record is actually displayed ?

Saravanan Ayyanar [Syncfusion]
Replied On January 14, 2020 01:07 PM UTC

Hi Silvio, 
Thank you for using Syncfusion controls. 
We have checked your reported scenario. You can achieve your requirement by getting the PagedCollectionView.InternalList. Using this internal list you can calculate the PageIndex using SfDataPager.PageSize property.  It working same as for while sorting the SfDataGrid. Please refer the below code snippet. 
private void Button_Click(object sender, RoutedEventArgs e) 
    var collection = (this.dataGrid.View as PagedCollectionView).GetInternalList(); 
    int i = 0; 
    foreach (var rec in collection) 
        var value = (rec as OrderInfo).OrderID; 
        if ((int)value == 1019) 
            int index = i / this.sfDataPager.PageSize; 
            this.sfDataPager.PageIndex = index; 
            this.dataGrid.SelectedIndex = i % this.sfDataPager.PageSize; 
            var rowindex = this.dataGrid.ResolveToRowIndex(this.dataGrid.SelectedIndex); 
            var visualcontainer = this.dataGrid.GetVisualContainer(); 
Sample Link: 
Please let us know, if you require further assistance on this. 
Saravanan A. 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon