Click here to Skip to main content
15,886,095 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,

I have treeview in asp.net i have to check if selected node is parent.

VB
 If TreeView1.SelectedNode = TreeView1.SelectedNode.Parent Then' this line generates error
            txtParentPhase.Text = ""
Else
     txtParentPhase.Text = TreeView1.SelectedNode.Parent.Text
End If


Thanks in advance.
Posted
Updated 25-Jul-11 0:37am
v2

1 solution

How can a selected node and it's parent be the same? Your logic is wrong. If you wish to check if a Node is selected or not, you have to check if the SelectedNode is null (Nothing in VB).
 
Share this answer
 
Comments
Tarun.K.S 25-Jul-11 6:38am    
Correct. 5+

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



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