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

[Solved] Problem With SelectedItem and SelectedItems

1 Answer 133 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Ryan
Top achievements
Rank 1
Ryan asked on 31 Dec 2009, 04:36 PM
I'm getting a strange thing - I have a hierarchical grid, if the grid has 1 parent, and multiple children, if you click on one of the children the SelectedItem returns Nothing, and SelectedItems.Count = 0.  If you click on the parent, it returns the selected item correctly.  If you click on a child in grid that has multiple parents, it seems to return the selected item fine too.  So it seems like it doesn't return children in the grid if there is only a single parent.  Anyone know of a workaround?

Thanks.

1 Answer, 1 is accepted

Sort by
0
Stefan Dobrev
Telerik team
answered on 06 Jan 2010, 08:43 AM
Hi Ryan,

In a hierarchy scenario every grid has its own selection mechanism. Thus when you select a child item it will not appear as selected in its parent grid. Same is true in the reverse. If you want to handle the selection at one place you can subscribe to the handled SelectionChanged routed event. Here is a sample code:
this.gridView.AddHandler(RadGridView.SelectionChangedEvent, MySelectionChanged, true)

Hope this helps,
Stefan Dobrev
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
Ryan
Top achievements
Rank 1
Answers by
Stefan Dobrev
Telerik team
Share this question
or