R
Rodrigo S. Novelli
Hi all!
I am using the TreeView control from IE Web Controls but I am having problems getting the selected node through the SelectedNodeIndex property.
I created a new C# project, created a webform, created a user control and, inside the user control I put a TreeView control (using the IDE). I fill the TreeView at run time, within the PageLoad event (when IsPostBack is false). The TreeView renders fine when executed. When the user clicks a button I try to get the selected node using the following code:
TreeNode node = TreeView1.GetNodeFromIndex( TreeView1.SelectedNodeIndex );
But the attribute node is always null. What is happening is that the property SelectedNodeIndex always returns an empty string (""), even when I selected a node in the web page (through mouse or keyboard).
I saw others post at the internet, and I tried setting the AutoPostBack property to true, the AutoSelect property and I even tried the following code (that doesn't make any sense to me):
TreeNode node = TreeView1.GetNodeFromIndex( TreeView1.SelectedNodeIndex.ToString() );
I have no ideia what might be missing. Do I have to set some property, or is there a bug in the tree view control?
Does anyone already have a problem like this?
Any tip or help is welcome!!
Thanks in advance,
Rodrigo S. Novelli
(e-mail address removed)
I am using the TreeView control from IE Web Controls but I am having problems getting the selected node through the SelectedNodeIndex property.
I created a new C# project, created a webform, created a user control and, inside the user control I put a TreeView control (using the IDE). I fill the TreeView at run time, within the PageLoad event (when IsPostBack is false). The TreeView renders fine when executed. When the user clicks a button I try to get the selected node using the following code:
TreeNode node = TreeView1.GetNodeFromIndex( TreeView1.SelectedNodeIndex );
But the attribute node is always null. What is happening is that the property SelectedNodeIndex always returns an empty string (""), even when I selected a node in the web page (through mouse or keyboard).
I saw others post at the internet, and I tried setting the AutoPostBack property to true, the AutoSelect property and I even tried the following code (that doesn't make any sense to me):
TreeNode node = TreeView1.GetNodeFromIndex( TreeView1.SelectedNodeIndex.ToString() );
I have no ideia what might be missing. Do I have to set some property, or is there a bug in the tree view control?
Does anyone already have a problem like this?
Any tip or help is welcome!!
Thanks in advance,
Rodrigo S. Novelli
(e-mail address removed)