Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does master page get called first?

I would assume this is true, but wanted to throw this question up. Is the master page executed first in ASP.NET, or does the page which is getting retrieved?

I am asking because I want some processing to be done in the master page, results of which are loaded into a static object and which can then be used by the called page (for instance user data)

like image 549
Serguei Fedorov Avatar asked May 08 '12 19:05

Serguei Fedorov


1 Answers

Sorry for just quoting, but i don't know what to add:

Individual ASP.NET server controls have their own life cycle that is similar to the page life cycle. For example, a control's Init and Load events occur during the corresponding page events.

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). Master pages behave like child controls on a page: the master page Init event occurs before the page Init and Load events, and the master page Load event occurs after the page Init and Load events.

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

enter image description here

like image 76
Tim Schmelter Avatar answered Sep 30 '22 14:09

Tim Schmelter