Update Parent Row in GridViewRelation

2 posts, 0 answers
  1. Bao
    Bao avatar
    54 posts
    Member since:
    Jan 2015

    Posted 15 Sep 2017 Link to this post

    Hi ,

    I have Hierarchical Gridview. When loading i loop all of the rows:

    foreach(var row in datagridview1.Rows)


        if(row.Type == "Childrend")


                 var parentRow = row.Parent as GridViewRowInfo; <----- it returns Null



    How can i get parent Row of child Row when loading ? Now at the childRow, i can get the parent Id and i have to loop all of the gridview again to find the parent row by ParentId .


  2. Dess | Tech Support Engineer, Sr.
    Dess | Tech Support Engineer, Sr.  avatar
    3532 posts

    Posted 18 Sep 2017 Link to this post

    Hello Bao, 

    Thank you for writing.  

    If you iterate the RadGridView.Rows collection you are actually iterating the parent rows in the grid. That is why the cast is not successful. I have prepared a sample project for your reference where the CurrentRowChanged is handled. If you click a child row, its parent row's first cell value is extracted successfully. Please refer to the attached zip file.

    Feel free to use our support ticketing system in future where you can provide a sample project demonstrating the exact problem that you are facing. Thus, Telerik support will gladly assist you.

    I hope this information helps.

    Progress Telerik
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top