ASP.NET Page Events Lifecycle
When using master pages, the normal page event lifecycle is a little different. Here is the actual order:
- Page.OnPreInit
- MasterPageControl.OnInit (for each control on the master page)
- Control.OnInit (for each contol on the page)
- MasterPage.OnInit
- Page.OnInit
- Page.OnInitComplete
- Page.LoadPageStateFromPersistenceMedium
- Page.LoadViewState
- MasterPage.LoadViewState
- Page.OnPreLoad
- Page.OnLoad
- MasterPage.OnLoad
- MasterPageControl.OnLoad (for each control on the master page)
- Control.OnLoad (for each control on the page)
- OnXXX (control event)
- MasterPage.OnBubbleEvent
- Page.OnBubbleEvent
- Page.OnLoadComplete
- Page.OnPreRender
- MasterPage.OnPreRender
- MasterPageControl.OnPreRender (for each control on the master page)
- Control.OnPreRender (for each control on the page)
- Page.OnPreRenderComplete
- MasterPageControl.SaveControlState (for each control on the master page)
- Control.SaveControlState (for each control on the page)
- Page.SaveViewState
- MasterPage.SaveViewState
- Page.SavePageStateToPersistenceMedium
- Page.OnSaveStateComplete
- MasterPageControl.OnUnload (for each control on the master page)
- Control.OnUnload (for each control on the page)
- MasterPage.OnUnload
- Page.OnUnload