I have a treeview1:
treenode--
开发者_StackOverflow社区 treenode1--
treenode2
treenode3
You can select only node2 and node3 if you want to display them parameters. How can i block selecting node and node1? I try like that,but than you can select all nodes:
private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
{
...
}
you will have to use SelectAction Property on the tree node. you will need to set it on the node when you are creating them.
set selectaction=none on node and node1
If it's a win forms TreeView handle the BeforeSelect event and set the Cancel property of your TreeViewCancelEventArgs parameter to false. For web controls see Vinay's answer.
精彩评论