ASP.NET TreeView和选择节点问题 [英] ASP.NET TreeView and Selecting Node Issue

查看:91
本文介绍了ASP.NET TreeView和选择节点问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在捕获在SelectedNodeChanged中单击TreeView的Selected Node的事件,但并非每次都触发.但是有时候它会被选中. SelectedNodeChanged应该更改,因为选择已明显更改,但无法正常工作.那么,我可以捕获什么事件,以便知道单击了选定节点"?

更重要的是,一个第一个父节点及其子节点被选中,并且剩余父节点甚至不会被触发.请问这是什么行为?

我正在以这种方式添加节点!

Hi,

I am capturing the event of the clicking the Selected Node of a TreeView in SelectedNodeChanged,but It is not firing everytime. But some times it is getting selected. SelectedNodeChanged should change since the selection has obviously changed but it is not working. So, what event can I catch so I know that the Selected Node was clicked?

And more importantly, one first Parent node and its child node is bing selected and remaing Parents are not even triggered. What is this behavior, any idea please?

I am adding nodes in this way!

TreeNode lObjTreeNode = null;

lObjTreeNode = new TreeNode("NewNode");

lObjTreeNode.SelectAction = =TreeNodeSelectAction.Select;


并添加节点.

请对此有任何想法.


and adding the nodes.

Any ideas on this please.

推荐答案

我在.NET Framework 4和2.0上使用了以下代码,它为我提供了被选中的节点:

I used the following code on .NET Framework 4 and 2.0 and it gave me the node which was selected:

private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
       {
           MessageBox.Show(e.Node.Text);
       }



希望这会有所帮助.



Hope this helps.


这篇关于ASP.NET TreeView和选择节点问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆