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

Hierarchy SelectionChanged Event

2 Answers 91 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Xavier
Top achievements
Rank 1
Xavier asked on 11 Oct 2011, 09:35 AM
Hello,
I have a Hierarchy RadGridView that works fine.

But there are 2 things I can'y achieve :
1. There can't be more than one row selected => if for example a user selects a row in the child Grid, no other row in the parent Grid must be selected. The same if the user selects a row in the parent Grid....
2. I want to retrieve the ID of the selected Row. It works if the user selects a row in the parent Grid, but not if the user selectd a row in th child Grid. In the SelectionChanged event, I cast e to GridViewDataControl, to be able to test ParentRow, but it's not working...

Thanks a lot for your help.
Xavier

2 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 11 Oct 2011, 09:57 AM
Hi Xavier,

Please take a look at this forum thread for a reference on how to achieve the first functionality that you require. 
Considering your second question, you could handle SelectionChanged event of the parent grid that will be fired for the child grid as well. You could handle it similar to:

void clubsGrid_SelectionChanged(object sender, SelectionChangeEventArgs e)
        {
            if(e.AddedItems.LastOrDefault() is Club)
            {
                MessageBox.Show("You have selected an item from the parent grid.");
            }
            else if (e.AddedItems.LastOrDefault() is Player)
            {
                MessageBox.Show("You have selected an item from the child grid.");
            }
        }

 

All the best,
Maya
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Xavier
Top achievements
Rank 1
answered on 11 Oct 2011, 11:06 AM
Perfect !!!!!
Thanks a lot !
Tags
GridView
Asked by
Xavier
Top achievements
Rank 1
Answers by
Maya
Telerik team
Xavier
Top achievements
Rank 1
Share this question
or