The Lifecycle of an ASP.Net page from start to end
Here is the detailed view of ASP.Net Page life cycle in easy way to understad:
- OnInit:-Initialize the page and each child control of the page.
- Load Control State:-Loads the control state of the controlto use this method,the control must call the Page.RegisterRequiresControlState method in the OnInit Event of the control.
- Load ViewState:- Loads the viewstate of the control to get the associated value of the control in hidden form field.
- LoadPostData:- It is defined on interface IsPostBackDataHandler.Control that implement this interface use this method to retrieve the incoming form data and updated the control's property accordingly.
- Load (On Load):-Allows action that are common to every request to be written here.at this time the control become stable, it has been initialized and its state has been reconstructed.
- RaisePostDataEventChanged:-It is defined in the interface IsPostBackDataHandler controls that implemets this interface use this event to change events in responce to the postback data changing between the current postback and the previous postback .
- RaisePostBack Event:- Handles the client side event that caused the postback to occur.
- PreRender(On PreRender):-This event takes place after all postback event have take place.this event occurs before saving viewstate so any changes made here are saved.
- SaveControlState:-Saves the current control state to viewstate.After this stage any chages o the control state are lost. To use this method control must call the Page.RegisterRequiresControlState method in OnInit method of the control.
- SaveViewState:-Saves the current data state in viewstate of the control after this stage any chages made to data are lost.
- Render:-Generate the client side HTML,DHTML and scripts that are necessary to properly display the page and controls in the browser.At this stage any chages to the control are persisted in viewstate.
- Dispose:-Accepts cleanup code,release any unmanaged ressources used in the code.
- Unload:-Executed once memory is released for webpage.
No comments:
Post a Comment