Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
What Events?
Message
General information
Forum:
ASP.NET
Category:
Other
Title:
Miscellaneous
Thread ID:
00771154
Message ID:
00771419
Views:
11
Dave,

Thanks for the pointers, but I can't figure out where to stick this code. I've read the article and tried putting the code in several places, but intellisense doesn't seem to recognize it and if I ignore intellisense and put the code in anyway, I keep getting the compiler error, "The event 'System.Web.UI.WebControls.Button.Click' can only appear on the left hand side of += or -=". Here's the code I'm trying to use:
// I tried putting it in the button's base class:
Delegate[] delegates = this.Click.GetInvocationList();

// I tried putting it in the UserControl:
Delegate[] delegates = this.MyButton.Click.GetInvocationList();

// I even tried overriding the OnClick() method in the button's base class:
protected override void OnClick(EventArgs e)
{
    Delegate[] delegates = Click.GetInvocationList();
    base.OnClick (e);
}
Click *is* the Event, so why doesn't this work? I'm obviously missing some critical point. Any idea what that might be?

~~Bonnie


>>My question is this: is there something I can do to see what events have fired and which event handlers have been delegated to handle the event? I suspect something goes wrong in the wiring somewhere in there, and being able to track which events are actually firing might help me find where it's going wrong.
>>
>
>You ought to be able to call GetInvocationList to see a list of delegates for the event:
>
>      Delegate[] delegates =
>         MyEvent.GetInvocationList();
>
>
>I have never done this but you can read about it here: http://www.fawcette.com/vsm/2003_05/magazine/columns/qa/
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform