Hi,
How to access the TreeListEditCommandColumn in the code behind. I was trying to access from code behind, but i could not able to acess.
Please help me out.Please refer the below code for your reference.
If i can acces the
How to access the TreeListEditCommandColumn in the code behind. I was trying to access from code behind, but i could not able to acess.
Please help me out.Please refer the below code for your reference.
If i can acces the
TreeListEditCommandColumn , from that i can able to hide the plus button in the parent node. or i can set the visible true/false.
<telerik:RadTreeList ID="treeListClientBudget" runat="server" OnNeedDataSource="treeListClientBudget_NeedDataSource" Visible="false" HideExpandCollapseButtonIfNoChildren="true" DataKeyNames="DataKey" Height="200px" OnChildItemsDataBind="treeListClientBudget_ChildItemsDataBind" OnItemDataBound="treeListClientBudget_ItemDataBound" ParentDataKeyNames="ParentKey" AutoGenerateColumns="false" AllowLoadOnDemand="true" EditMode="InPlace" OnUpdateCommand="treeListClientBudget_UpdateCommand" OnInsertCommand="treeListClientBudget_InsertCommand" OnCancelCommand="treeListClientBudget_CancelCommand" OnEditCommand="treeListClientBudget_EditCommand"> <ClientSettings Selecting-AllowItemSelection="true" Scrolling-AllowScroll="true" Scrolling-UseStaticHeaders="true" > <Selecting AllowToggleSelection="true"/> </ClientSettings> <Columns> <telerik:TreeListEditCommandColumn UniqueName="InsertCommandColumn" ShowAddButton="false" ButtonType="ImageButton" ShowEditButton="false" HeaderStyle-Width="30px" ItemStyle-HorizontalAlign="Center"> <HeaderStyle Width="60px" /> <ItemStyle Width="60px" /> </telerik:TreeListEditCommandColumn> <telerik:TreeListButtonColumn CommandName="Edit" Text="Edit" UniqueName="EditCommandColumn" ButtonType="ImageButton" HeaderStyle-Width="30px" ItemStyle-HorizontalAlign="Center"> </telerik:TreeListButtonColumn> <telerik:TreeListButtonColumn UniqueName="DeleteCommandColumn" Text="Delete" CommandName="Delete" ButtonType="ImageButton" HeaderStyle-Width="30px"></telerik:TreeListButtonColumn> <telerik:TreeListBoundColumn DataField="DisplayName" UniqueName="DisplayName" ReadOnly="true" HeaderText="Month/Classification"> </telerik:RadTreeList>please refer the code for Codebehind .CS
protected void treeListClientBudget_ItemDataBound(object sender, TreeListItemDataBoundEventArgs e) { if (e.Item is TreeListDataItem) { TreeListDataItem item = e.Item as TreeListDataItem; //hdnClassificationId.Value = Convert.ToString(item.GetDataKeyValue("DataKey")); switch (item.HierarchyIndex.NestedLevel) { case 0: item.BackColor = System.Drawing.Color.LightYellow; break; case 1: item.BackColor = System.Drawing.Color.YellowGreen; ImageButton treelist = item["TreeListEditCommandColumn"].FindControl("InsertCommandColumn") as ImageButton; //treelist.ShowAddButton = true; // hdnClassificationId.Value =Convert.ToString( item.GetDataKeyValue("DataKey")); break; case 2: item.BackColor = System.Drawing.Color.LightPink; item["InsertCommandColumn"].Visible = true; break; } } }