Am Using Telerik Grid In my Windows 8 Metro App.
Howw Do I get the Selected Row Index in Grid?
I Mean When i Click on perticular Row I want to get all the values in that row.
Thanks
Arjun
5 Answers, 1 is accepted
Hello Arjun,
Thank you for the question.
There are two ways to get the selected item of the RadDataGrid:
-
You can use the SelectionChanged event of the RadDataGrid:
void
RadDataGrid_SelectionChanged(
object
sender, DataGridSelectionChangedEventArgs e)
{
var selectedItem = e.AddedItems.FirstOrDefault()
as
DataItemClass;
}
-
The RadDataGrid has a SelectedItem property:
var selectedItem = grid.SelectedItem
as
DataItemClass;
This is a dependency property, that you can also bind to a property from your view model.
I hope this was useful. Please, let us know if you have further questions.
Regards,Rositsa Topchiyska
Telerik
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Thanks For The Reply.
My Question Is I Want Row Index Directly.. Not The Items In That ROW..
Hi Arjun,
You can use the RadDataGrid.GetDataView() method to get the list of all data items that are currently contained in the View and get the index of the selected item like this:
private
void
RadDataGrid_SelectionChanged(
object
sender, DataGridSelectionChangedEventArgs e)
{
var selectedItem = e.AddedItems.FirstOrDefault()
as
Data;
if
(selectedItem !=
null
)
{
var index = (sender
as
RadDataGrid).GetDataView().Items.ToList().IndexOf(selectedItem);
}
}
I hope this helps. Please, let us know if we can assist you in some other way.
Regards,Rositsa Topchiyska
Telerik
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

How to Get Selected Items From The RAD GRID ?
You can check this help article - http://www.telerik.com/help/windows-8-xaml/raddatagrid-selection.html
Regards,
Tsvyatko
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.