Message
From
25/02/2010 18:23:44
Timothy Bryan
Sharpline Consultants
Conroe, Texas, United States
 
General information
Fórum:
ASP.NET
Category:
Miscellaneous
ID da thread:
01451022
ID da mensagem:
01451110
Views:
22
Kevin, I am using Telerik but the ASP control has SelectedNodeChanged. Either way it works the same way. No matter which node is clicked the same handler is fired and you have to get the value to determine which node they clicked on.

Tim

>I dont know what TreeView you're code is reffering to, but there is no NodeClick event on the treeview control.
>
>
>>>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
Responder
Mapa
View