This question is locked. New answers and comments are not allowed.
I am using a RadDataGrid to show a grid of employees. How do I save the employee_id as the datakey, and then use that datakey to perform functions in my code behind when an employee is selected
3 Answers, 1 is accepted
0
Hello Josh,
Thank you for your interest.
You can get the selected item or items through the RadDataGrid.SelectedItem and the RadDataGrid.SelectedItems properties. Depending on the current RadDataGrid.SelectionUnit(Cell or Row), the received value would be of type DataGridCellInfo or object(or respectively collections of these types). From the DataGridCellInfo class you can also access the corresponding object through the Item property. Thus, you can get all the needed information.
For more reference you can check the following help article - http://www.telerik.com/help/windows-8-xaml/raddatagrid-selection.html.
Let me know if this helps.
Ivaylo Gergov
the Telerik team
Thank you for your interest.
You can get the selected item or items through the RadDataGrid.SelectedItem and the RadDataGrid.SelectedItems properties. Depending on the current RadDataGrid.SelectionUnit(Cell or Row), the received value would be of type DataGridCellInfo or object(or respectively collections of these types). From the DataGridCellInfo class you can also access the corresponding object through the Item property. Thus, you can get all the needed information.
For more reference you can check the following help article - http://www.telerik.com/help/windows-8-xaml/raddatagrid-selection.html.
Let me know if this helps.
Greetings,
Ivaylo Gergov
the Telerik team
Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
0
josh
Top achievements
Rank 1
answered on 20 May 2013, 01:49 PM
Ivaylo, Thanks for your response. However I am still having issues...I have the SelectionUnit to "Cell" for now. Here is my selection chambed method. What am I doing wrong?
private void radGridPatients_SelectionChanged_2(object sender, Telerik.UI.Xaml.Controls.Grid.DataGridSelectionChangedEventArgs e)
{
Telerik.UI.Xaml.Controls.Grid.DataGridCellInfo cI = (Telerik.UI.Xaml.Controls.Grid.DataGridCellInfo)radGridPatients.SelectedItem ;
Label1.Text = cI.Item.ToString();
}
0
Hi Josh,
For your convenience, I have attached a project that shows how get and ID that is associated with the selected item in the RadDataGrid.
I hope this helps. Feel free to contact us if you have any other questions.
Regards,
Ivaylo Gergov
Telerik
For your convenience, I have attached a project that shows how get and ID that is associated with the selected item in the RadDataGrid.
I hope this helps. Feel free to contact us if you have any other questions.
Regards,
Ivaylo Gergov
Telerik
Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.