Hi I have a bit of a doozie.
I have a control with a click event attached. As far as I can see the event should be raised during postback. Things I have checked:
What am I missing so the framework can handle this event?
Suggestions on a postcard or below please
I found the problem: it was a third party control registering itself requiring a raise event. This information was found by using custom class inherited from Page, overrode RegisterRequiresRaiseEvent and placing a break point on entry of the overrode sub.
Public Class Page
Inherits System.Web.UI.Page
Public Overrides Sub RegisterRequiresRaiseEvent(ByVal control As System.Web.UI.IPostBackEventHandler)
If TypeOf control Is Infragistics.WebUI.UltraWebGrid.UltraWebGrid Then Exit Sub
MyBase.RegisterRequiresRaiseEvent(control)
End Sub
End Class
Without the code here's a few things that may be causing problems:
myButton.Click += new EventHandler(myButton_Click)
, and that is not being done on every request. It could be behind a logical path not executed You have to make sure that the event is wired up in the request cycle. You can do this using the following methods:
There are other possible ways to wire up the events, eg you could do it manually in your code somewhere. But I've found these 2 options to be the safest so that you will be sure that your events will be fired
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.