Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP .Net server control events order

Which are the events of an ASP .Net server control and how does their order relate to the containing page's events?

The concrete problem is that I am looking for an event inside the server control that fires before the Page_Load event of the containing page.

like image 815
Germstorm Avatar asked Dec 07 '25 04:12

Germstorm


2 Answers

With regards to how they relate to Page events, at least for Init and Load:

"Although both Init and Load recursively occur on each control, they happen in reverse order. The Init event (and also the Unload event) for each child control occur before the corresponding event is raised for its container (bottom-up). However the Load event for a container occurs before the Load events for its child controls (top-down)."

From http://msdn.microsoft.com/en-us/library/ms178472.aspx

like image 99
Corbin March Avatar answered Dec 08 '25 18:12

Corbin March


Check out this page. It will let you know what events fire when. Looks like you could use the PreLoad event.

like image 25
Craig Avatar answered Dec 08 '25 16:12

Craig



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!