row index

5 posts, 0 answers
  1. David Johnson
    David Johnson avatar
    4 posts
    Member since:
    Jun 2009

    Posted 01 Sep 2009 Link to this post

    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

  2. Milan
    Admin
    Milan avatar
    1989 posts

    Posted 02 Sep 2009 Link to this post

    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.
  3. Enal
    Enal avatar
    39 posts
    Member since:
    Oct 2011

    Posted 10 Jan 2012 Link to this post

    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!
  4. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 11 Jan 2012 Link to this post

    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 >>

  5. Enal
    Enal avatar
    39 posts
    Member since:
    Oct 2011

    Posted 16 Jan 2012 Link to this post

    Ok, thanks. This leads to a larger issue but I better start a new thread. Thanks!
Back to Top