Reputation: 11471
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?
Upvotes: 7
Views: 7277
Reputation: 86506
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.
Upvotes: 12
Reputation: 18142
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
}
Upvotes: 27