This is a migrated thread and some comments may be shown as answers.

row index

4 Answers 134 Views
GridView
This is a migrated thread and some comments may be shown as answers.
David Johnson
Top achievements
Rank 1
David Johnson asked on 01 Sep 2009, 09:58 PM

Hi,

I’m performing discreet paging and I need to be able to track the row index as the user scrolls through the grid.

The standard Microsoft DataGrid contains a LoadingRow event which allows me to then grab e.Row.GetIndex().

How might I accomplish this using the RadGridView

Thank you
dj

4 Answers, 1 is accepted

Sort by
0
Milan
Telerik team
answered on 02 Sep 2009, 01:46 PM
Hi David Johnson,

RadGridView has a similar event called RowLoaded. Just subscribe to the event and in the event handler do something like:

void playersGrid_RowLoaded(object sender, RowLoadedEventArgs e)  
{  
    if (e.Row is GridViewHeaderRow || e.Row is GridViewNewRow || e.Row is GridViewFooterRow)  
        return;  
 
    var row = e.Row as GridViewRow;  
    int index = this.MyGrid.Items.IndexOf(row.DataItem);  

Hope this helps

All the best,
Milan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Enal
Top achievements
Rank 1
answered on 10 Jan 2012, 08:36 PM
Hello - 

Unfortunately this API doesn't seem to exist:  row.DataItem 
How does one get the row/column index of a cell these days?

Thanks!
0
Maya
Telerik team
answered on 11 Jan 2012, 07:35 AM
Hi Enal,

You can work with the Item property of GridViewRow instead - row.Item. 

Kind regards,
Maya
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Enal
Top achievements
Rank 1
answered on 16 Jan 2012, 07:55 PM
Ok, thanks. This leads to a larger issue but I better start a new thread. Thanks!
Tags
GridView
Asked by
David Johnson
Top achievements
Rank 1
Answers by
Milan
Telerik team
Enal
Top achievements
Rank 1
Maya
Telerik team
Share this question
or