When a page is requested, it is loaded into the server memory, processed, and sent to the browser. Then it is unloaded from the memory. At each of these steps, methods and events are available, which could be overridden according to the need of the application
The page life cycle phases are:
- Initialization
- Instantiation of the controls on the page
- Restoration and maintenance of the state
- Execution of the event handler codes
- Page rendering
When we execute a Web page, it passes from the following stages, which are collectively known as Web page lifecycle:
- Page request - During this stage, ASP.NET makes sure the page either parsed or compiled and a cached version of the page can be sent in response
- Start - During this stage sets the Request and Response page properties and the page check the page request is either a postback or a new request
- Page Initialization - During this stage, the page initialize and the control's Unique Id property are set
- Load - During this stage, if the request is postback, the control properties are loaded without loading the view state and control state otherwise loads the view state
- Validation - During this stage, the controls are validated
- Postback event handling - During this stage, if the request is a postback, handles the event
- Rendering - During this stage, the page invokes the Render method to each control for return the output
- Unload - During this stage, when the page is completely rendered and sent to the client, the page is unloaded.
Following are the page life cycle events:
- PreInit
- Init
- InitComplete
- PreLoad
- Load
- Postback event(Such as button_click,etc.)
- LoadComplete
- PreRender
- SaveStateComplete
- PreRenderComplete
- UnLoad
No comments:
Post a Comment