I can easily understand how to use custom events in pure C# code, but how can I do pass in custom event arguments on asp:button click?
I’ve tried all sorts of things (defining new event args, new delegates, etc etc) but I have had no luck.
Is there a tutorial of how to do this with the standard asp controls?
As long as your EventArgs inherit from System.EventArgs you will be able to pass them. Then, once inside your event handler, you can cast the event to the proper subtype.
Here is an example:
I know that you are working with existing control delegates so unfortunately this kind of casting is neccessary. Keep in mind though that there is a
EventHandler<T> where T : EventArgsdelegate in .NET 2.0 and greater that will allow you to do what I have done above without casting.