我得到了这个错误:
Exception Description : E:sitesEPER ENAdminDBDataFilter.ascx.vb(144): error BC32022: 'Public Event Click(sender As Object, e As System.EventArgs)' is an event,
and cannot be called directly. Use a 'RaiseEvent' statement to raise an event. Source File : Line : 0
在以下vb.net代码中:
submitFilterButton.Click += New EventHandler(AddressOf submitFilterButtonHandler_Click)
这个错误是什么意思?
如果要以编程方式注册事件处理程序,则必须使用:AddHandler
:
AddHandler submitFilterButton.Click, AddressOf submitFilterButtonHandler_Click
您也可以在aspx标记上以声明方式添加它(处理程序必须是受保护的/public(
OnClick="submitFilterButtonHandler_Click"
或者通过Handles
子句(可以是私有的(在代码后台
Private Sub submitFilterButtonHandler_Click(sender As System.Object, e As System.EventArgs) Handles submitFilterButton.Click
如何:在ASP.NET网页中创建事件处理程序