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

Selecting Child Template does not change parent row

2 Answers 103 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 19 Mar 2013, 12:25 AM
Hi,

I'm having a problem where I have a gridview with a master and child template.  I noticed that the parent row doesn't seem to be changing when I select a child row from a different row unless I select the parent row first.  The parent row will only change when I select the parent row directly.  If I move from one expanded child row to another expanded child row (a different parent record) this will not update any bound textbox controls with the parent row values.  The previous row values remain in the bound textbox controls.

I may be missing something obvious here but I would have thought that selecting childrows in different records should change the underlying parent record.

Thanks for any advice on this.

2 Answers, 1 is accepted

Sort by
0
Michael
Top achievements
Rank 1
answered on 19 Mar 2013, 12:38 PM
This worked for me to get the parentrow selected when the associated childrow is clicked.  In case its of use to anyone else.

//Selecting a childrow sets the linked parentrow as current to update any databound controls
GridViewTemplate template = myGridView.CurrentRow.ViewTemplate;
e.Row.ViewInfo.ParentRow.IsCurrent = true;

With some help from the below forum postings to determine how to work with childrow selection

Select rows only in master template

http://www.telerik.com/community/forums/winforms/gridview/select-rows-only-in-master-template.aspx

Chang Current Row at chang current row at hierarchical

http://www.telerik.com/community/forums/winforms/gridview/chang-current-row-at-chang-current-row-at-hierarchical.aspx

How can I determine which childrow was click in a heirarchical gridview

http://www.telerik.com/community/forums/winforms/gridview/how-can-i-determine-which-childrow-was-click-in-a-heirarchical-gridview.aspx

How to set new row values in a hierarchical grid

http://www.telerik.com/community/forums/winforms/gridview/how-to-set-new-row-values-in-a-hierarchical-grid.aspx
0
Stefan
Telerik team
answered on 21 Mar 2013, 02:56 PM
Hi Michael,

Thank you for sharing your solution with the community.

Should you have any other questions, do not hesitate to contact us.
 

Kind regards,
Stefan
the Telerik team
WinForms Q1 2013 boasts PivotGrid, PDF Viewer, Chart enhancements and more. Check out all of the latest highlights.
Tags
GridView
Asked by
Michael
Top achievements
Rank 1
Answers by
Michael
Top achievements
Rank 1
Stefan
Telerik team
Share this question
or