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

Get the row number from hover or selection

1 Answer 49 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Yonatan
Top achievements
Rank 1
Yonatan asked on 15 Apr 2013, 10:37 AM
Hello,

In the RadGridview, How can I get the row number from the row the user has selected\hovered over? I need the number in order to zoom to a specific part of an adjoined map(according to the row). I tried taking it out of  the sender in a radgridview_SelectionChanged event by doing the following:

int iRow = Convert.ToInt16(((System.Windows.Controls.TextBlock((((Telerik.Windows.Controls.Gridview.GridViewRowItem)
sender).Cells[0].Content)).Text);

But it has a Invalidcastexception (from radgridview to gridviewrowitem).

Please help.

1 Answer, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 15 Apr 2013, 01:44 PM
Hello,

You can directly access the bound data item and work with it insead:

(e.AddedItems[0] as YourBusinessObject).NumberValue
 
I hope this works better.

Kind regards,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
GridView
Asked by
Yonatan
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Share this question
or