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

GridViewRow.RowIndex

1 Answer 113 Views
GridView
This is a migrated thread and some comments may be shown as answers.
WILLIAM
Top achievements
Rank 1
WILLIAM asked on 07 Jun 2012, 02:03 PM
I'm trying to determine the index of a row that was the target row of the context menu.  I can get the row, but in order to get the index of the row, the examples/responses in other posts is to do the following:

radGridView.Items.IndexOf(clickedGridRow.DataContext);

Does this loop through each row until you have matched the data item, and then return the index of the loop?

Why can't GridViewRow simply have a RowIndex property?  Surely there is a way to get this value without looping over the collection.

1 Answer, 1 is accepted

Sort by
0
Ivan Ivanov
Telerik team
answered on 11 Jun 2012, 06:21 AM
Hi,

The recommended approach to retrieve a row's index is to use the following method:
radGridView.ItemContainerGenerator.IndexFromContainer(row);

Kind regards,
Ivan Ivanov
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
Tags
GridView
Asked by
WILLIAM
Top achievements
Rank 1
Answers by
Ivan Ivanov
Telerik team
Share this question
or