Reputation: 45921
I'm working with the treeview and I've seen that I can get the selected node, but when I try to look for it on TreeView I can't find it because TreeView.Nodes only has rootNode. What's happening?
I'm doing this on the same method:
This is the defenition of treeview on aspx page:
<asp:TreeView ID="DestinationTree" runat="server" CssClass="destinationsTree" ExpandDepth="1"
onselectednodechanged="DestinationTree_SelectedNodeChanged"
ontreenodeexpanded="DestinationTree_TreeNodeExpanded" ShowLines="True"
Font-Names=""Segoe UI",Frutiger,Tahoma,Helvetica,"Helvetica Neue",Arial,sans-serif">
<ParentNodeStyle Font-Bold="False" />
<HoverNodeStyle Font-Underline="True" ForeColor="#5555DD" />
<SelectedNodeStyle Font-Underline="True" ForeColor="#5555DD" HorizontalPadding="0px" VerticalPadding="0px" />
<Nodes>
TreeView is inside an Ajax UpdatePanel. I use TreeNodeExpand to add more nodes, and SelectedNodeChange to enable and disable buttons.
Any adviced?
Upvotes: 2
Views: 475
Reputation: 57919
Every node also has a Nodes
property. Use a recursive function to walk the tree to find it.
Upvotes: 1