4 Answers, 1 is accepted
0
Hi,
You can use SelectedItem to achieve your goal:
var index = RadGridView1.Items.IndexOf(RadGridView1.SelectedItem);
All the best,
Vlad
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
You can use SelectedItem to achieve your goal:
var index = RadGridView1.Items.IndexOf(RadGridView1.SelectedItem);
All the best,
Vlad
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
![](/forums/images/avatarimages/default.gif)
Walter
Top achievements
Rank 1
answered on 11 Feb 2014, 11:12 AM
Does not working for me :/ My selected item is on position of 0 and debuger shows
radGridView.SelectedItem.GetHashCode() = X
radGridView.Items[0].GetHashCode() = Y
Obviously in debuger queries
radGridView.SelectedItem
radGridView.Items[0]
shows same object.
Where is the problem?
Regards
Walter
radGridView.SelectedItem.GetHashCode() = X
radGridView.Items[0].GetHashCode() = Y
Obviously in debuger queries
radGridView.SelectedItem
radGridView.Items[0]
shows same object.
Where is the problem?
Regards
Walter
0
![](/forums/images/avatarimages/default.gif)
Walter
Top achievements
Rank 1
answered on 11 Feb 2014, 01:55 PM
Force bindings update helps in my case:
var selectedItemBindingExpression = radGridView.GetBindingExpression( RadGridView.SelectedItemProperty );
if( selectedItemBindingExpression != null )
{
selectedItemBindingExpression.UpdateTarget();
}
var itemsSourceBindingExpression = radGridView.GetBindingExpression( RadGridView.ItemsSourceProperty );
if( itemsSourceBindingExpression != null )
{
itemsSourceBindingExpression.UpdateTarget();
}
var selectedItemBindingExpression = radGridView.GetBindingExpression( RadGridView.SelectedItemProperty );
if( selectedItemBindingExpression != null )
{
selectedItemBindingExpression.UpdateTarget();
}
var itemsSourceBindingExpression = radGridView.GetBindingExpression( RadGridView.ItemsSourceProperty );
if( itemsSourceBindingExpression != null )
{
itemsSourceBindingExpression.UpdateTarget();
}
0
![](/forums/images/avatarimages/default.gif)
Joseph
Top achievements
Rank 1
answered on 23 Sep 2020, 03:06 PM
Thanks! this worked for my application. I originally used RadGridView1.SelectedItems and the index of the selected item was always 0 because I have a single selection list. I though about what I did and was like, duh. It will always be 0 for a single selection list.