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

    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. 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

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