I am trying to use the Page_LoadComplete
in my user control myusercontrol.ascx.cs
but its not getting fired up, I added a break point and nothing, it is possible that the user control does not support this event? and if thats the case what can I use instead?
LoadComplete is not automatically wired up.. You'll have to do that yourself.
protected void Page_Load(object sender, EventArgs e)
{
Page.LoadComplete += new EventHandler(Page_LoadComplete);
}
void Page_LoadComplete(object sender, EventArgs e)
{
//Do your deed
}
Reference: http://connect.microsoft.com/VisualStudio/feedback/details/103322/page-loadcomplete-doesnt-fire-in-custom-controls
The LoadComplete
event only happens on the Page
. For a control, if you want to do something after the other controls' Load
events have fired, about the closest you'll get is PreRender
.
Alternatively, you could attach to the Page's LoadComplete
event in your control's init stuff. But AFAIK it won't happen automatically.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With