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

[Solved] Hierarchical grid

2 Answers 58 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Simon
Top achievements
Rank 1
Simon asked on 12 Jul 2011, 04:13 PM
Hi,

I am making use of the Telerik MVC grid to display hierarchical data. I have implemented something similar to the demo shown here: http://demos.telerik.com/aspnet-mvc/grid/hierarchyajax.

In the event that the child grid has no data, I would like to hide the expand option. i.e. I would like to remove the link denoted by the following html.

<a class="t-icon t-minus" href="http://demos.telerik.com/aspnet-mvc/grid/hierarchyajax#"/>

Can this be achieved and if so how?

Thanks

2 Answers, 1 is accepted

Sort by
0
Accepted
Rosen
Telerik team
answered on 13 Jul 2011, 08:29 AM
Hello Simon,

The easiest way to achieve the desired functionality is to add a property to the model which signify if the item has details. Then by using the rowDataBound event you should hide the expand button. 
The additional property is required as the inner grid are populated on demand (when master item is expanded), thus the information if the grid contains records is not available initially.

I have attached a small sample which demonstrates the suggested approach.

Best wishes,
Rosen
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
Simon
Top achievements
Rank 1
answered on 13 Jul 2011, 03:33 PM
Thanks - that worked a treat!
Tags
Grid
Asked by
Simon
Top achievements
Rank 1
Answers by
Rosen
Telerik team
Simon
Top achievements
Rank 1
Share this question
or