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

[Solved] Multi column treeview

0 Answers 125 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Payal Mandalia
Top achievements
Rank 1
Payal Mandalia asked on 04 Feb 2010, 05:54 AM
Hello everyone,

I am currently working with radtreeview control.

I have used this control to display all the sitemaps for the website I am working on.Each node in this treeview are checkable but now I needed another checkbox  as an added control with each node with text 'canEdit' to assign permission to the users to edit sections or view sections of the particular sitemap.I have achieved the second checkbox for each node but now the issue is when I am checking the second checkbox , the second checkbox disappears and instead it checks the checkbox of the node...
 
//Class to specify node template as per node  
 
public class multipleColumnTreeViewNode : ITemplate  
            {  
                public void InstantiateIn(Control container)  
                {  
                    Label space = new Label();  
                    space.Text = ((RadTreeNode)container).Text + "          ";  
                    space.ID = "lbSpace";  
                    space.Attributes.Add("runat""server");  
                    container.Controls.Add(space);  
 
                    CheckBox cbCanEdit = new CheckBox();  
                    cbCanEdit.ID = "cbCanEdit";  
                    cbCanEdit.Attributes.Add("runat""server");  
                    cbCanEdit.AutoPostBack = true;  
                    cbCanEdit.CheckedChanged += new EventHandler(cbCanEdit_CheckedChanged);  
                    cbCanEdit.Text = "can edit";  
                    cbCanEdit.ForeColor = System.Drawing.Color.PaleGoldenrod;  
                    cbCanEdit.TextAlign = TextAlign.Left;  
                    container.Controls.Add(cbCanEdit);  
                }  
 
                private void cbCanEdit_CheckedChanged(object sender, EventArgs e)  
                {  
                   //Code here  
                }  
 
 
 //Adding actionCategory and user actions nodes to sitemap treeview nodes  
                    if (dtActionCategory.Rows.Count != 0 && datTable.Rows.Count != 0)  
                    {  
                        var actionCats = from actionCatsData in dbcontext.userActionCategories  
                                         where actionCatsData.actionCategoryID == int.Parse(datRow["actionCategoryID"].ToString())  
                                         select new { actionCatsData.actionCategoryID, actionCatsData.name };  
 
                        if (actionCats.Count() != 0)  
                        {  
                            foreach (var tempData in actionCats)  
                            {  
                                RadTreeNode actionCatNode = new RadTreeNode(tempData.name);  
                                actionCatNode.ToolTip = "ActionCategory - Tick to make all the actions under this category active for the role";  
                                actionCatNode.Value = "ActionCategory:" + tempData.actionCategoryID.ToString();  
                                actionCatNode.ForeColor = System.Drawing.Color.Yellow;                                  
                                treeNode.Nodes.Add(actionCatNode);  
 
                                var actions = from actionData in dbcontext.userActions  
                                              where actionData.actionCategoryID == int.Parse(datRow["actionCategoryID"].ToString())  
                                              select new { actionData.actionID, actionData.description };  
 
                                if (actions.Count() != 0)  
                                {  
                                    foreach (var data in actions)  
                                    {                                                                                                                                               
                                        RadTreeNode actionNode = new RadTreeNode(data.description);                                          
                                        actionNode.Text = data.description;  
                                        actionNode.NodeTemplate = new multipleColumnTreeViewNode();               
                                        actionNode.ToolTip = "Action - Tick to make this sitemap action active for the role";  
                                        actionNode.Value = "Action:" + data.actionID.ToString();                                          
                                        actionNode.ForeColor = System.Drawing.Color.PaleGoldenrod;                                         
                                        actionCatNode.Nodes.Add(actionNode);  
                                    }  
                                }  
                            }  
                        }  
                    }  
                    //Adding the node to the treeview with all the child nodes  
                    nodes.Add(treeNode);                     
                } 

I would really appreciate it if anyone could help me around this problem...

Thanks in advance,
Payal Sharma.

No answers yet. Maybe you can help?

Tags
TreeView
Asked by
Payal Mandalia
Top achievements
Rank 1
Share this question
or