I'm sure someone has figured this out by now. I'm at my wits end trying to get it to work. Very little help in the documentation and forums on how to do this.
I have a Grid with about 4 nested tables:
I've tried this but it will not work on any nested DetailTables:
Public Sub HideExpandColumnRecursive(ByVal tableView As GridTableView)
Dim test As String = Nothing
Dim nestedViewItems As GridItem() = tableView.GetItems(GridItemType.NestedView)
For Each nestedViewItem As GridNestedViewItem In nestedViewItems
For Each nestedView As GridTableView In nestedViewItem.NestedTableViews
If nestedView.Items.Count = 0 Then
Dim cell As TableCell = nestedView.ParentItem("ExpandColumn")
cell.Controls(0).Visible = False
nestedViewItem.Visible = False
End If
If nestedView.HasDetailTables Then
HideExpandColumnRecursive(nestedView)
End If
Next
Next
End Sub
I understand the I have to do a recursive search and set visible to false for all the detailTables as above but I cant figure out how to do this. I read the online help and still cant get it to work. Does anyone have an example on how to hide the expand/collapse image in a multi nested table scenario?
Thank you for your help. Shouldn't this be built in???
<telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="SqlDataSourceParent"
GridLines="None" Skin="Telerik" ShowGroupPanel="True">
<MasterTableView AutoGenerateColumns="False" DataSourceID="SqlDataSourceParent" DataKeyNames="PART_ID" NoDetailRecordsText="" HierarchyLoadMode="ServerBind">
<DetailTables>
<telerik:GridTableView runat="server" DataKeyNames="PART_ID" DataSourceID="sqlDataSourceSub"
GridLines="Both" NoDetailRecordsText="">
<RowIndicatorColumn>
<HeaderStyle Width="20px" />
</RowIndicatorColumn>
<DetailTables>
<telerik:GridTableView runat="server" DataSourceID="sqlDataSourceSub0"
DataKeyNames="PART_ID" NoDetailRecordsText="">
<DetailTables>
<telerik:GridTableView runat="server" DataSourceID="sqlDataSourceSub1"
DataKeyNames="PART_ID" NoDetailRecordsText="">
<DetailTables>
<telerik:GridTableView runat="server" DataKeyNames="PART_ID"
DataSourceID="SqlDataSourceSub2">
<ParentTableRelation>
<telerik:GridRelationFields DetailKeyField="PART_ID" MasterKeyField="PART_ID" />
</ParentTableRelation>
<RowIndicatorColumn>
<HeaderStyle Width="20px" />
</RowIndicatorColumn>
<ExpandCollapseColumn>
<HeaderStyle Width="20px" />
</ExpandCollapseColumn>
</telerik:GridTableView>
</DetailTables>
<ParentTableRelation>
<telerik:GridRelationFields DetailKeyField="PART_ID" MasterKeyField="PART_ID" />
</ParentTableRelation>
<RowIndicatorColumn>
<HeaderStyle Width="20px" />
</RowIndicatorColumn>
<ExpandCollapseColumn Visible="True">
</ExpandCollapseColumn>
</telerik:GridTableView>
</DetailTables>
<ParentTableRelation>
<telerik:GridRelationFields DetailKeyField="PART_ID" MasterKeyField="PART_ID" />
</ParentTableRelation>
<RowIndicatorColumn>
<HeaderStyle Width="20px" />
</RowIndicatorColumn>
<ExpandCollapseColumn Visible="True">
<HeaderStyle Width="20px" />
</ExpandCollapseColumn>
</telerik:GridTableView>
</DetailTables>
<ParentTableRelation>
<telerik:GridRelationFields DetailKeyField="PART_ID" MasterKeyField="PART_ID" />
</ParentTableRelation>
<ExpandCollapseColumn Visible="True">
</ExpandCollapseColumn>
</telerik:GridTableView>
</DetailTables>
<ExpandCollapseColumn Visible="True">
</ExpandCollapseColumn>
<Columns>
<telerik:GridBoundColumn DataField="PART_ID" HeaderText="PART_ID" SortExpression="PART_ID"
UniqueName="PART_ID">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="BASE_ID" HeaderText="BASE_ID" SortExpression="BASE_ID"
UniqueName="BASE_ID">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="DESCRIPTION" HeaderText="DESCRIPTION" SortExpression="DESCRIPTION"
UniqueName="DESCRIPTION">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="QTY_ON_HAND" HeaderText="QTY_ON_HAND" SortExpression="QTY_ON_HAND"
UniqueName="QTY_ON_HAND">
</telerik:GridBoundColumn>
</Columns>
</MasterTableView>
<ClientSettings AllowColumnsReorder="True" AllowDragToGroup="True"
ReorderColumnsOnClient="True">
</ClientSettings>
</telerik:RadGrid>
I have a Grid with about 4 nested tables:
I've tried this but it will not work on any nested DetailTables:
Public Sub HideExpandColumnRecursive(ByVal tableView As GridTableView)
Dim test As String = Nothing
Dim nestedViewItems As GridItem() = tableView.GetItems(GridItemType.NestedView)
For Each nestedViewItem As GridNestedViewItem In nestedViewItems
For Each nestedView As GridTableView In nestedViewItem.NestedTableViews
If nestedView.Items.Count = 0 Then
Dim cell As TableCell = nestedView.ParentItem("ExpandColumn")
cell.Controls(0).Visible = False
nestedViewItem.Visible = False
End If
If nestedView.HasDetailTables Then
HideExpandColumnRecursive(nestedView)
End If
Next
Next
End Sub
I understand the I have to do a recursive search and set visible to false for all the detailTables as above but I cant figure out how to do this. I read the online help and still cant get it to work. Does anyone have an example on how to hide the expand/collapse image in a multi nested table scenario?
Thank you for your help. Shouldn't this be built in???
<telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="SqlDataSourceParent"
GridLines="None" Skin="Telerik" ShowGroupPanel="True">
<MasterTableView AutoGenerateColumns="False" DataSourceID="SqlDataSourceParent" DataKeyNames="PART_ID" NoDetailRecordsText="" HierarchyLoadMode="ServerBind">
<DetailTables>
<telerik:GridTableView runat="server" DataKeyNames="PART_ID" DataSourceID="sqlDataSourceSub"
GridLines="Both" NoDetailRecordsText="">
<RowIndicatorColumn>
<HeaderStyle Width="20px" />
</RowIndicatorColumn>
<DetailTables>
<telerik:GridTableView runat="server" DataSourceID="sqlDataSourceSub0"
DataKeyNames="PART_ID" NoDetailRecordsText="">
<DetailTables>
<telerik:GridTableView runat="server" DataSourceID="sqlDataSourceSub1"
DataKeyNames="PART_ID" NoDetailRecordsText="">
<DetailTables>
<telerik:GridTableView runat="server" DataKeyNames="PART_ID"
DataSourceID="SqlDataSourceSub2">
<ParentTableRelation>
<telerik:GridRelationFields DetailKeyField="PART_ID" MasterKeyField="PART_ID" />
</ParentTableRelation>
<RowIndicatorColumn>
<HeaderStyle Width="20px" />
</RowIndicatorColumn>
<ExpandCollapseColumn>
<HeaderStyle Width="20px" />
</ExpandCollapseColumn>
</telerik:GridTableView>
</DetailTables>
<ParentTableRelation>
<telerik:GridRelationFields DetailKeyField="PART_ID" MasterKeyField="PART_ID" />
</ParentTableRelation>
<RowIndicatorColumn>
<HeaderStyle Width="20px" />
</RowIndicatorColumn>
<ExpandCollapseColumn Visible="True">
</ExpandCollapseColumn>
</telerik:GridTableView>
</DetailTables>
<ParentTableRelation>
<telerik:GridRelationFields DetailKeyField="PART_ID" MasterKeyField="PART_ID" />
</ParentTableRelation>
<RowIndicatorColumn>
<HeaderStyle Width="20px" />
</RowIndicatorColumn>
<ExpandCollapseColumn Visible="True">
<HeaderStyle Width="20px" />
</ExpandCollapseColumn>
</telerik:GridTableView>
</DetailTables>
<ParentTableRelation>
<telerik:GridRelationFields DetailKeyField="PART_ID" MasterKeyField="PART_ID" />
</ParentTableRelation>
<ExpandCollapseColumn Visible="True">
</ExpandCollapseColumn>
</telerik:GridTableView>
</DetailTables>
<ExpandCollapseColumn Visible="True">
</ExpandCollapseColumn>
<Columns>
<telerik:GridBoundColumn DataField="PART_ID" HeaderText="PART_ID" SortExpression="PART_ID"
UniqueName="PART_ID">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="BASE_ID" HeaderText="BASE_ID" SortExpression="BASE_ID"
UniqueName="BASE_ID">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="DESCRIPTION" HeaderText="DESCRIPTION" SortExpression="DESCRIPTION"
UniqueName="DESCRIPTION">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="QTY_ON_HAND" HeaderText="QTY_ON_HAND" SortExpression="QTY_ON_HAND"
UniqueName="QTY_ON_HAND">
</telerik:GridBoundColumn>
</Columns>
</MasterTableView>
<ClientSettings AllowColumnsReorder="True" AllowDragToGroup="True"
ReorderColumnsOnClient="True">
</ClientSettings>
</telerik:RadGrid>