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

Update Parent Row in GridViewRelation

1 Answer 116 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Bao
Top achievements
Rank 1
Bao asked on 15 Sep 2017, 05:35 PM

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 .

 

1 Answer, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 18 Sep 2017, 07:37 AM
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.

Regards,
Dess
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.
Tags
GridView
Asked by
Bao
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or