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

Incorrect RowIndex

1 Answer 124 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Rafael
Top achievements
Rank 1
Rafael asked on 08 Dec 2020, 11:43 AM

Hi, i'm starting with Telerik.

I'm trying to understand a particular behavior about RowIndex. I'm checking RowIndex of each GridViewItem and it's not going like expected.

Instead of list 1,2,3 it's showing 2, 4, 6. I'm wondering why is it happening.

 

1 Answer, 1 is accepted

Sort by
0
Accepted
Vessy
Telerik team
answered on 11 Dec 2020, 09:24 AM

Hi Rafael,

The RowIndex the index of the item in the rows collection of the underlying server Table control. In order to get the index of the actual rows in the Grid, you will need to use the ItemIndex property:

        foreach (GridDataItem dataItem in grid.Items)
        {
            var index = dataItem.ItemIndex;
            //your logic here
        }

Regards,
Vessy
Progress Telerik

control

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Grid
Asked by
Rafael
Top achievements
Rank 1
Answers by
Vessy
Telerik team
Share this question
or