Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
TreeNode Click Event
Message
From
25/02/2010 16:45:29
Timothy Bryan
Sharpline Consultants
Conroe, Texas, United States
 
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
01451022
Message ID:
01451074
Views:
21
>I don't see a NodeClick event on an ASP.Net TreeView control.
>
>How do I detech when the user clicks a node?

Kevin,

I am using a treeview to change the controls I display on the page. I do it like this:
 /// <summary>
        /// Left Menu Node Click Handler
        /// </summary>
        /// <param name="sender">Sender</param>
        /// <param name="e">EventArgs</param>
        protected void tvAboutMenu_NodeClick(object sender, RadTreeNodeEventArgs e)
        {
            if (e.Node.Value.Length < 3)
                return;

            if (e.Node.Value.Substring(0, 3) == "BIO")
            {
                this.bioName = e.Node.Value.Substring(3, e.Node.Value.Length -3).ToUpper();
                this.DisplayContent(AboutDisplayType.Biography);
            }
            else
            {
                switch (e.Node.Value)
                {
                    case "History":
                        this.DisplayContent(AboutDisplayType.History);
                        break;
                    //case "ByLaws":
                    //    Response.Redirect("~/Resources/MSAbylaws.pdf", false);
                    //    break;
                    case "Chart":
                        this.DisplayContent(AboutDisplayType.OrgChart);
                        break;
                    case "Corner":
                        this.DisplayContent(AboutDisplayType.ChairmansCorner);
                        break;
                    case "Board" :
                        e.Node.Expanded = true;
                        this.bioName = "KELLEY";
                        this.DisplayContent(AboutDisplayType.Biography);
                        break;
                    case "Chapters" :
                        e.Node.Expanded = true;
                        break;
                }
            }
           
        }
You have to set the node values for each node to something you can use in this event to determine which node was selected.
The DisplayContent method creates the UserControl and adds it to the page.
Tim
Timothy Bryan
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform