I have a hierarchical grid where the parent and the children all use the same column headers such as follows. Everything looks fine when I show the Action column. When I hide the Action column, however, the column's contents remain in the child rows (e.g., where the Type is Child in the example below) and the formatting is messed up (see below).
I'm setting the grdNotes.Columns.FindByUniqueName("Actions").Visible = ShowActionColumn (where ShowActionColumn is a bool property set by the user preferences) in the Page_Load event.
What else needs to be done to hide the contents of the child row's column contents? (I've already tried setting toolbar.visible=false, but to no avail.)
FWIW, here's the definition of the grid:
ActionColumn.Visible = true;
ID Parent Name Type Action1 - Note Parent O:E:D2 1 Reply Child O:E3 2 Reply Child O:E4 - Note Parent O:E:DActionColumn.Visible = false;ID Parent Name Type 1 - Note Parent 2 1 Reply Child O:E3 2 Reply Child O:E4 - Note Parent I'm setting the grdNotes.Columns.FindByUniqueName("Actions").Visible = ShowActionColumn (where ShowActionColumn is a bool property set by the user preferences) in the Page_Load event.
What else needs to be done to hide the contents of the child row's column contents? (I've already tried setting toolbar.visible=false, but to no avail.)
FWIW, here's the definition of the grid:
<telerik:RadGrid ID="grdNotes" runat="server" OnColumnCreated="grdNotes_ColumnCreated" OnItemCreated="grdNotes_ItemCreated" OnItemDataBound="grdNotes_ItemDataBound" OnNeedDataSource="grdNotes_NeedDataSource" OnPreRender="grdNotes_PreRender" AutoGenerateColumns="false" SkinID="HierarchicalGrid" GridLines="None" AllowPaging="false" AllowCustomPaging="True" ShowStatusBar="True" EnableLinqExpressions="True" PageSize="20" Width="100%"> <HeaderContextMenu EnableTheming="True"> <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> </HeaderContextMenu> <ClientSettings Selecting-AllowRowSelect="true" Resizing-AllowColumnResize="true"> <ClientEvents OnRowSelected="RowSelected" OnRowContextMenu="NoteContextMenu" OnRowCreated="RowCreated" OnRowDblClick="grdNotes_OnRowDblClick" OnColumnResized="ResizeAllColumns" OnGridCreated="PageLoad" /> </ClientSettings> <PagerStyle Position="Bottom" AlwaysVisible="True" Mode="NextPrevAndNumeric" Wrap="False" BackColor="White" Font-Size="Large" /> <MasterTableView HierarchyDefaultExpanded="true" HierarchyLoadMode="Client" AllowSorting="true" DataKeyNames="Id,ParentId,Token,IsRoot,Replies,NoteCreator" ClientDataKeyNames="Id,ParentId,Token,IsRoot,Replies,NoteCreator" NoDetailRecordsText="" EnableNoRecordsTemplate="False" Width="100%"> <SelfHierarchySettings ParentKeyName="ParentId" KeyName="Id" MaximumDepth="20" /> <Columns> <telerik:GridBoundColumn DataField="Id" HeaderText="Id" SortExpression="Id" UniqueName="Id" ReadOnly="True" HeaderStyle-Width="10%"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="Title" HeaderText="Title" SortExpression="Title" UniqueName="Title" HeaderStyle-Width="20%" /> <telerik:GridBoundColumn DataField="Body" HeaderText="Body" SortExpression="Body" UniqueName="Body" HeaderStyle-Width="40%" /> <telerik:GridBoundColumn DataField="CreatedBy" HeaderText="Created By" SortExpression="CreatedBy" UniqueName="CreatedBy" HeaderStyle-Width="15%" /> <telerik:GridBoundColumn DataField="CreatedDate" HeaderText="Created On" SortExpression="CreatedDate" UniqueName="CreatedOn" HeaderStyle-Width="15%" /> <telerik:GridBoundColumn DataField="ParentId" HeaderText="Parent Id" SortExpression="ParentId" UniqueName="ParentId" Visible="false" /> <telerik:GridBoundColumn DataField="Token" HeaderText="Token" SortExpression="Token" UniqueName="Token" Visible="true" /> <telerik:GridBoundColumn DataField="IsRoot" HeaderText="IsRoot" SortExpression="IsRoot" UniqueName="IsRoot" Visible="false" /> <telerik:GridBoundColumn DataField="Replies" HeaderText="Replies" SortExpression="Replies" UniqueName="Replies" Visible="false" /> <telerik:GridBoundColumn DataField="NoteCreator" HeaderText="NoteCreator" SortExpression="NoteCreator" UniqueName="NoteCreator" Visible="false" /> <telerik:GridTemplateColumn UniqueName="Actions" HeaderStyle-Width="150" HeaderText="Actions"> <ItemTemplate> <telerik:RadToolBar ID="rtbNoteActions" runat="server" SkinID="ActionToolbar" OnButtonClick="NotesGridToolbarButtonClicked" OnClientButtonClicking="NoteActionToolbarClicking"> <Items> <telerik:RadToolBarButton Text="Properties" CommandName="Properties" ImageUrl="~/Images/page_view.gif" /> <telerik:RadToolBarButton Text="Reply" CommandName="Reply" ImageUrl="~/Images/page_edit.gif" /> <telerik:RadToolBarButton Text="Security" CommandName="Security" ImageUrl="~/Images/shield16.gif" /> <telerik:RadToolBarButton Text="Delete" CommandName="Delete" ImageUrl="~/Images/delete16.gif" /> </Items> </telerik:RadToolBar> </ItemTemplate> </telerik:GridTemplateColumn> </Columns> </MasterTableView> <FilterMenu EnableTheming="True"> <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> </FilterMenu></telerik:RadGrid>