Using the below declarations ...
.... I've tried to programmatically hide the 'plus' sign next to top level nodes with no children nodes using this c# ....
Line 14 above ALWAYS indicates that the "nestedView.Items.Count" equals zero. I know for a fact that some of the nodes have more than one item in their nested views. I kn ow this because they show themselves when I comment out line 3 in the C#.
Any help would be greatly appreciated.
Paul
| <telerik:RadGrid runat="server" id="grdClients" |
| OnNeedDataSource="grdClients_NeedDataSource" |
| OnItemCreated="grdClients_ItemCreated" |
| Skin="Default2006" |
| AutoGenerateColumns="False" |
| AllowPaging ="True" |
| AllowSorting="True" |
| PageSize="8" |
| GridLines="None" |
| ShowStatusBar="False" |
| Width="100%" > |
| <ExportSettings> |
| <Excel Format="Html" /> |
| </ExportSettings> |
| <PagerStyle Mode="NextPrevAndNumeric"></PagerStyle> |
| <ClientSettings AllowExpandCollapse="true" /> |
| <MasterTableView DataKeyNames="Id, SuperClientId"> |
| <SelfHierarchySettings ParentKeyName="SuperClientId" KeyName="Id" MaximumDepth="0" /> |
| <Columns> |
| <telerik:GridHyperLinkColumn |
| DataTextField="Id" |
| DataTextFormatString="edit" |
| UniqueName="colEditbasePage" |
| DataNavigateUrlFormatString="editClient.aspx?id={0}" |
| DataNavigateUrlFields="id"> |
| </telerik:GridHyperLinkColumn> |
| <telerik:GridHyperLinkColumn |
| DataTextField="Id" |
| DataTextFormatString="deactivate" |
| UniqueName="colDeactivateClient" |
| DataNavigateUrlFormatString="?deactivateid={0}" |
| DataNavigateUrlFields="Id"> |
| </telerik:GridHyperLinkColumn> |
| <telerik:GridBoundColumn |
| DataField="CompanyName" |
| DataType="System.String" |
| HeaderText="Company Name" |
| SortExpression="CompanyName" |
| UniqueName="colCompanyName" > |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn |
| DataField="City" |
| DataType="System.String" |
| HeaderText="City" |
| SortExpression="City" |
| UniqueName="colCity" > |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn |
| DataField="Country" |
| DataType="System.String" |
| HeaderText="Country" |
| SortExpression="Country" |
| UniqueName="colCountry" > |
| </telerik:GridBoundColumn> |
| <telerik:GridTemplateColumn HeaderText="Roles I fill"> |
| <ItemTemplate> |
| <table cellpadding="1" cellspacing="1" class="customTable"> |
| <tr> |
| <td style="width: 50%"> |
| <%# getRoleIndicator((int)DataBinder.Eval(Container.DataItem, "Id"), Settings.Default.role_clientCGC)%> |
| </td> |
| <td style="width: 50%"> |
| <%# getRoleIndicator((int)DataBinder.Eval(Container.DataItem, "Id"), Settings.Default.role_clientCC)%> |
| </td> |
| </tr> |
| </table> |
| </ItemTemplate> |
| </telerik:GridTemplateColumn> |
| <telerik:GridBoundColumn |
| DataField="NumOfRequestsBought" |
| DataType="System.Int32" |
| HeaderText="Number of Requests Purchased" |
| SortExpression="NumOfRequestsBought" |
| UniqueName="colNumOfRequestsBought" > |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn |
| DataField="NumOfRequestsUsed" |
| DataType="System.Int32" |
| HeaderText="Number of Requests Used" |
| SortExpression="NumOfRequestsUsed" |
| UniqueName="colNumOfRequestsUsed" > |
| </telerik:GridBoundColumn> |
| <telerik:GridCheckBoxColumn |
| DataField="PurchasedApprovals" |
| HeaderText="Purchased Approvals" |
| AllowSorting="true" |
| UniqueName="colPurchasedApprovals" > |
| </telerik:GridCheckBoxColumn> |
| <telerik:GridCheckBoxColumn |
| DataField="PurchasedAgreements" |
| HeaderText="Purchased Agreements" |
| AllowSorting="true" |
| UniqueName="colPurchasedAgreements" > |
| </telerik:GridCheckBoxColumn> |
| </Columns> |
| </MasterTableView> |
| </telerik:RadGrid> |
.... I've tried to programmatically hide the 'plus' sign next to top level nodes with no children nodes using this c# ....
| public void Page_PreRenderComplete(object sender, EventArgs e) | |
| { | |
| HideExpandColumnRecursive(grdClients.MasterTableView); | |
| } | |
| public void HideExpandColumnRecursive(GridTableView tableView) | |
| { | |
| GridItem[] nestedViewItems = tableView.GetItems(GridItemType.NestedView); | |
| foreach (GridNestedViewItem nestedViewItem in nestedViewItems) | |
| { | |
| foreach (GridTableView nestedView in nestedViewItem.NestedTableViews) | |
| { | |
| if (nestedView.Items.Count == 0) | |
| { | |
| TableCell cell = nestedView.ParentItem["ExpandColumn"]; | |
| cell.Controls[0].Visible = false; | |
| nestedViewItem.Visible = false; | |
| } | |
| if (nestedView.HasDetailTables) | |
| HideExpandColumnRecursive(nestedView); | |
| } | |
| } | |
| } | |
| } | |
Line 14 above ALWAYS indicates that the "nestedView.Items.Count" equals zero. I know for a fact that some of the nodes have more than one item in their nested views. I kn ow this because they show themselves when I comment out line 3 in the C#.
Any help would be greatly appreciated.
Paul
