本文介绍了'TreeView2_SelectedNodeChanged'的重载与委托'System.EventHandler'不匹配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,



我已将EventArgs指向e.Node上的错误,即System.EventArgs不包含Node的定义。



如果我用TreeNodeEventArgs替换EventArgs,那么该错误消失但我在编译时出错:



编译器错误信息:CS0123:'TreeView2_SelectedNodeChanged'没有重载匹配委托'System.EventHandler'



< asp:TreeView ID =" TreeView2" RUNAT = QUOT;服务器" OnUnload =" TreeViewMain_Unload"

ontreenodepopulate =" TreeView2_TreeNodePopulate"

onselectednodechanged =" TreeView2_SelectedNodeChanged">

<节点>

< asp:TreeNode PopulateOnDemand =" True" Text =" Machine Groups"
Value =" Machine Groups"< / asp:TreeNode>

< / Nodes>

< / asp:TreeView>

请帮帮我。

Hello,

I have put EventArgs it points to an error on e.Node that System.EventArgs does not contain definition for Node.

If i replace EventArgs with TreeNodeEventArgs, then that error goes away but I get an error on compilation:

Compiler Error Message: CS0123: No overload for 'TreeView2_SelectedNodeChanged' matches delegate 'System.EventHandler'

<asp:TreeView ID="TreeView2" runat="server" OnUnload="TreeViewMain_Unload"
ontreenodepopulate="TreeView2_TreeNodePopulate"
onselectednodechanged="TreeView2_SelectedNodeChanged">
<Nodes>
<asp:TreeNode PopulateOnDemand="True" Text="Machine Groups"
Value="Machine Groups"></asp:TreeNode>
</Nodes>
</asp:TreeView>
Please help me out.

推荐答案

TreeView objTreeView = (TreeView)sender;
           if (objTreeView != null)
           {
               TreeNode selectedNode = objTreeView.SelectedNode;
               //Do something
           }





你必须使用 System.EventArgs ,这就是活动支持的内容。



如果有帮助请告诉我。



Azee ......



and you'll have to use System.EventArgs and this is what the event supports.

Let me know if it helps.

Azee...


这篇关于'TreeView2_SelectedNodeChanged'的重载与委托'System.EventHandler'不匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-21 04:41