I have a class that inherits from Page.
In the OnLoad method i'm looping through all controls on the page (recursively) before i call base.OnLoad. If the control is a ImageButton (in this example) then i want to add an event handler for its clicked event.This code definatly gets called for each control that is an ImageButton.Code:if (Ctrl is ImageButton) { ((ImageButton)Ctrl).Click += new ImageClickEventHandler(ImageButtonClick); }
My ImageButtonClick event is as below:This NEVER gets called. I've double checked this by inserting int x = 0;x = 1 / x; within the method, so i know it never gets called.Code:public void ImageButtonClick(object sender, ImageClickEventArgs e) { new GUIWebEvent(sender.ToString(), "Click").Raise(); }
Any ideas why? My only thought is that i'm doing it in the OnLoad method, but i'm pretty stuck as to how i can get this to work.





Reply With Quote