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

Get SelectedItems of a Grid in a Grid

3 Answers 42 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Eugen Wiens
Top achievements
Rank 1
Eugen Wiens asked on 31 Jul 2012, 09:10 AM
Hello,

i have a GridView which has a Gridview as HierarchyChildTemplate. How can I get a reference to the SelectedItems of the child GridView?

Thanks

3 Answers, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 02 Aug 2012, 11:53 AM
Hi,

You could bind the SelectedItems property of the details GridView to a corresponding collection in your data object (shown as a parent item).  May I ask you when you will need to access the SelectedItems? Do you want to change them, or do you want just to read them?

Regards,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Eugen Wiens
Top achievements
Rank 1
answered on 02 Aug 2012, 12:57 PM
Hey,

thank you for the answer.

I solved the problem by subscribing to the SelectionChanged event of the child grid and in the event hanndler I store the SelectedItems in an instance variable in the code behind file. So when I need the SelectedItems, I get them from that instance variable.

I need the SelectedItems to perform some operations on the bound data objects. In that special case to call a delete routine.

Regards,
Eugen

0
Dimitrina
Telerik team
answered on 02 Aug 2012, 04:49 PM
Hello Eugen,

 Thank you for sharing your solution to the community. 

Regards,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

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