Tech Dreams

Sequence of Master-Content Page Events Execution [ASP.NET]

Life cycle of an ASP.NET web page has a series of events. We handle the appropriate events to plug in the required code for developing the web page. If we use Master-Content web pages of ASP.NET v2.0, it is important to understand the order in which the events of Master-Content pages are raised.

Till today I was in the assumption that events of Master page are raised before the Content page events are raised. But it is not true for all the events. For example Page Load of Content page is raised before Master pages Page Load event.

Here is the sequence in the which the events of Master-Content pages are executed

  1. Content page PreInit event.
  2. Master page controls Init event.
  3. Content controls Init event.
  4. Master page Init event.
  5. Content page Init event.
  6. Content page Load event.
  7. Master page Load event.
  8. Master page controls Load event.
  9. Content page controls Load event.
  10. Content page PreRender event.
  11. Master page PreRender event.
  12. Master page controls PreRender event.
  13. Content page controls PreRender event.
  14. Master page controls Unload event.
  15. Content page controls Unload event.
  16. Master page Unload event.
  17. Content page Unload event.

Happy programming!