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

How to get hierarchy parent when editing detail (RowEditEnded), or how to synchronize Current/Selected Item?

2 Answers 286 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Wellpartner
Top achievements
Rank 1
Wellpartner asked on 17 Sep 2010, 08:28 PM
I have a master/detail hierarchy and am wondering how to get a reference to the parent in the RowEditEnded event (see attached picture).  The RadGridView.CurrentItem and SelectedItem is the first row (Barney Rubble) even though I'm editing the detail on the third row (Pebbles).

Better yet, is there a way to set the CurrentItem or SelectedItem to be the corresponding master row when I'm at the detail level?  I have set IsSynchronizedWithCurrentItem="True" on the RadGridView control, but that seems to only work when I'm clicking on the parent rows.  When I click on a child row the Row Indicator doesn't change.

 

2 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 20 Sep 2010, 02:09 PM
Hello Wellpartner,

You may find the parent row during RowEditEnded event of the child grid as follows:

private void playersGrid_RowEditEnded(object sender, GridViewRowEditEndedEventArgs e)
{          
    RadGridView grid = sender as RadGridView;
    GridViewRow parentRow = grid.ParentRow as GridViewRow;                     
}

Thus you can easily set that row to be selected for the parent grid, using the IsSelected Property of the GridViewRow. 
The fact that the row, whose child is expanded, is not immediately set to be the selected one is the expected behavior as there may be more than one expanded child grids. In this case it is not obvious which should be the selected row in the parent grid. 
 

Sincerely yours,
Maya
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Wellpartner
Top achievements
Rank 1
answered on 20 Sep 2010, 07:13 PM
Thank you, Maya.
Tags
GridView
Asked by
Wellpartner
Top achievements
Rank 1
Answers by
Maya
Telerik team
Wellpartner
Top achievements
Rank 1
Share this question
or