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

Selecting nested RadGrid and accessing child & parent

1 Answer 226 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jarkko
Top achievements
Rank 1
Jarkko asked on 14 Aug 2012, 01:12 PM
I have a RadGrid that has another RadGrid nested which also has another nested RadGrid. So there are 3 levels: Level 1 has information about a costumer, level 2 has information about customerĀ“s purchases, and level 3 has info about products that the costumer has bought during the purchase. 

Now, I need to be able to select the level 2 row (purchase) and then access the data on all levels to construct a receipt of the purchase. I was able to add the checkbox column to level 2 by adding the GridClientSelectColumn to the column collection and enabling the client side row selection. So visually I have what I need. But my big problem now is: 

How do I access the data (contents of the cells) on all levels when I press a "print receipt for selected purchase" -button? I tried accessing it rought the RadGrid1.SelectedItems, but it was null. With just one RadGrid setup I could just use RadGrid1.SelectedItems[0].Cells, but that wont of course work with nested grids.

This might be a noob question, as I am very new to Telerik components. Any recommendations for "RadGrid for dummies" tutorials are welcome.

Thanks in advance! 

1 Answer, 1 is accepted

Sort by
0
Accepted
Marin
Telerik team
answered on 17 Aug 2012, 08:16 AM
Hello Jarkko,

 If you use the default HierarchyLoadMode of the grid you can access the rows in the PreRender event only if all of them are expanded. You can also manually expand the rows on the server by setting HierarchyDefaultExpanded="true" and rebinding the control. This is needed in case you want to access all the data on every level, of course it can take some time for the grid to bind all the data depending on how big the hierarchy is.
Once the rows are expanded you can easily iterate through each level and each row as shown in this help topic: http://www.telerik.com/help/aspnet-ajax/grid-traversing-detail-tables-items-in-grid.html 

Kind regards,
Marin
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
Jarkko
Top achievements
Rank 1
Answers by
Marin
Telerik team
Share this question
or