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

Hiding expand/collapse when using NestedViewTemplate

1 Answer 94 Views
Grid
This is a migrated thread and some comments may be shown as answers.
terrysmith
Top achievements
Rank 1
terrysmith asked on 27 Oct 2008, 08:48 PM
Hi,

I'm trying to hide the expand/collpase images on rows that do not have nested data. I've tried to follow the advice in your help doc:

ms-help://telerik.aspnetajax.radcontrols.2008.Q2/telerik.aspnetajax.radgrid.2008.Q2/hide-expand-collapse-images-when-no-records-in-self-referencing-hierarchy.html

However, it doesn't work for me, perhaps because I'm using the <NestedViewTemplate> approach to build the nested data? Your example uses the PreRender event to hide the expand/collapse. Following your other example of how to do the manual <NestedViewTemplate> approach, I'm already building the nested HTML in the PreRender event already with code similar to this:

Protected Sub grid_PreRender(ByVal sender As ObjectByVal e As System.EventArgs) Handles grid.PreRender 
   Dim items As Telerik.Web.UI.GridItem() = grid.MasterTableView.GetItems(Telerik.Web.UI.GridItemType.NestedView) 
 
   For Each item As Telerik.Web.UI.GridNestedViewItem In items 
      'Customize the NestedViewTemplate.    
      Dim myData As MyDataObject = DirectCast(item.DataItem, MyDataObject) 
      Dim nestedTable As Table = item.FindControl("nestedTable"
 
      ...Build the nested HTML 
 
   Next 
End Sub 

Since I'm already looping through the NestedView collection it seems like it should be easy to get to the expand/collapse cell, but after trying many different ways to access it in the object model I'm lost. So my question is how to get to the parent row's expand/collapse cell when I have a GridNestedViewItem object.

Also, I prefer to keep using HierarchyLoadMode="Client" to avoid post-backs if possible.

Thank you,
Terry


1 Answer, 1 is accepted

Sort by
0
terrysmith
Top achievements
Rank 1
answered on 28 Oct 2008, 08:17 PM
I've submitted support ticket ID 170483 for this.

Tags
Grid
Asked by
terrysmith
Top achievements
Rank 1
Answers by
terrysmith
Top achievements
Rank 1
Share this question
or