Below Page life cycle events executed in the sequence.
1.Page_Init 2.LoadViewState ( If the request is a post back ) 3. Page_Load 4.Post Back events ( Ex :Button_Click ) 5.Page_PreRender 6.SaveViewState 7.Render 8.UnLoad
What happens when these events fired.
Page_Init : 1.In the intialization Phase all the controls UniqueID property in that page will be set. 2.All Master pages and Themes and skins will be set. 3. Post back data is not available in this phase ( If the request is post back request ) 4. Page Controls Init event is Executed before Page_InIt
LoadViewState : 1. This event is fired only when the request is PostBack request. 2. All the control properties loaded with Controls ViewState values.
Page_Load: 1.All the control loaded fully with their properties. 2.Page_Load occurs first and then the Child controls Load will happen next. Ex: If you have Text Box named ” txtAge” on the Page Patient.aspx, first Page_Load will occur and txtAge_Load happens Next.
PostBack Events: 1. Post back events like Button_Click and TextBox1_TextChanged, Dropdown list “SelectedIndex_Changed” events will be fired in this stage.
Page_PreRender: 1.Sequence is Page_PreRender followed by ChildControls_PreRender 2.Inthis event Programmer can be able to change Response object.
SaveViewState: 1.ViewState for all the controls will be saved
Page_Render: 1. This method is responsible for generating html code for the page and also for all the controls. This can be done by Calling Render method for individual controls and for the page it-self.( We will see an example for this while working with Custom Controls )
Page_UnLoad: 1. Memory created for the Page class will be removed from the server ( IIS).
Note : For more info You can visit http://msdn.microsoft.com/en-us/library/ms178472(v=VS.90).aspx