Click here to Skip to main content
15,882,802 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I need help to create a breadcumb and a treeview only with two levels the parent and child...and each click on child will make that the parent goes to the sitemap

Anyone helps?


XML
string[] PathSize = TreeView1.SelectedNode.Value.Split('|');
            if (PathSize.Length <= 11)
            {
                StringBuilder path = new StringBuilder();
                StringBuilder pathURL = new StringBuilder();

                TreeNode node = TreeView1.SelectedNode;
                int idx = 0;

                List<string> nodes = new List<string>();

                while (node != null && idx < 5)
                {
                    path.Insert(0, string.Format("{0} > ", node.Text));
                    nodes.Add(node.Value);
                    node = node.Parent;
                    idx++;
                }

                if (path.Length > 0)
                    path.Remove(path.Length - 3, 3);

                MyAval.ZonMyAval_DAL WS_MyAval = new MyAval.ZonMyAval_DAL();

                if (HF_SelectedHierarchy.Value == "1")
                {
                    List<MyAval.GetAllResponsibilityNodes_Result> ListOrganization =
                    new List<MyAval.GetAllResponsibilityNodes_Result>();
                    ListOrganization = WS_MyAval.GetAllResponsibilityNodes(GetSearchDate(), TreeView1.SelectedNode.Value).ToList();

                    TreeView1.SelectedNode.ChildNodes.Clear();
                    for (int i = 0; i < ListOrganization.Count; i++)
                    {
                        TreeNode ChildNode = new TreeNode(ListOrganization[i].Description.ToUpper(), TreeView1.SelectedNode.Value + "|" + ListOrganization[i].NodeId);
                        TreeView1.SelectedNode.ChildNodes.Add(ChildNode);
                        TreeView1.SelectedNode.Expand();
                    }
                }
                else
                {
                    List<MyAval.GetAllOrganizationalNodes_Result> ListOrganization =
                        new List<MyAval.GetAllOrganizationalNodes_Result>();
                    ListOrganization = WS_MyAval.GetAllOrganizationalNodes(GetSearchDate(), TreeView1.SelectedNode.Value).ToList();

                    TreeView1.SelectedNode.ChildNodes.Clear();
                    for (int i = 0; i < ListOrganization.Count; i++)
                    {
                        TreeNode ChildNode = new TreeNode(ListOrganization[i].Description.ToUpper(), TreeView1.SelectedNode.Value + "|" + ListOrganization[i].NodeId);
                        TreeView1.SelectedNode.ChildNodes.Add(ChildNode);
                        TreeView1.SelectedNode.Expand();
                    }
                }
            }
            ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "Whaiterhidee", "HideWaiter();", true);

            string sNode = TreeView1.SelectedNode == null ? TreeView1.Nodes[0].Value : TreeView1.SelectedNode.Value;
Posted

1 solution

hi
treeViewControl.DoubleClick += new EventHandler(treeViewControl_DoubleClick);

private void treeViewControl_DoubleClick(object sender, EventArgs e)
{
Write code
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900