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

How to get data from row before and after the selected row?

1 Answer 27 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Kennet
Top achievements
Rank 2
Kennet asked on 07 Dec 2009, 08:20 AM
With Ms ListView I can do like this

int _selIndex = dataGrid.SelectedIndex;  
 
MyCollection _data1 = (MyCollection)dataGrid.Items[_selIndex - 1];  
MyCollection _data2 = (MyCollection)dataGrid.Items[_selIndex];  
MyCollection _data3 = (MyCollection)dataGrid.Items[_selIndex + 1]; 

But I can't figure out how to do this with RadGridView.

1 Answer, 1 is accepted

Sort by
0
Accepted
Vlad
Telerik team
answered on 07 Dec 2009, 08:57 AM
Hello Kennet,

You can get selected index from Items property:

var index = RadGridView1.Items.IndexOf(RadGridView1.SelectedItem);


Regards,
Vlad
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.
Tags
GridView
Asked by
Kennet
Top achievements
Rank 2
Answers by
Vlad
Telerik team
Share this question
or