Selecting Child Template does not change parent row

3 posts, 0 answers
  1. Michael
    Michael avatar
    10 posts
    Member since:
    Jan 2013

    Posted 18 Mar 2013 Link to this post


    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. Michael
    Michael avatar
    10 posts
    Member since:
    Jan 2013

    Posted 19 Mar 2013 Link to this post

    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

    Chang Current Row at chang current row at hierarchical

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

    How to set new row values in a hierarchical grid
  3. Stefan
    Stefan avatar
    2911 posts

    Posted 21 Mar 2013 Link to this post

    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,
    the Telerik team
    WinForms Q1 2013 boasts PivotGrid, PDF Viewer, Chart enhancements and more. Check out all of the latest highlights.
Back to Top