PreRender event not firing on ImageButton
Well there is a bug in ImageButton OnPreRender that simply don’t call base.OnPreRender so your event handler will never run. If you want to workaround this problem you can create your own ImageButton. Your new web custom control should overload OnPreRender and PreRender event.
The following code demonstrates ImageButton control that will raise PreRender event:
public class MyImageButton : ImageButton
{
public new event EventHandler PreRender;
public MyImageButton() : base()
{
}
protected override void OnPreRender(EventArgs e)
{
if (PreRender != null)
PreRender(this,e);
base.OnPreRender(e);
}
}
}