This article gives you an idea about life cycle of an ASP.NET page. When an ASP.Net page runs, the page goes through a life cycle in which it performs a series of processing steps. These include Page initialization, instantiating controls, restoring and maintaining state, running event handler code & rendering.
1.START:
As the name suggest this is the first step of a page life cycle. In the start step, page properties such as Request & Response are set. At this stage , the page also determines whether the request is a postback or a new request and sets the “IsPostBack” property. This step is often confused with the “Load” ,which is the third step.
2.PAGE INTIALIZATION:-
During the page initialization step, controls on the page are available and each controls unique ID property is set. If the current request is a postback,the postback data has not yet been loaded and control property values have not been restored to the values from view state.
3.LOAD
During Load, if the current request is a postback, control properties are loaded with info recovered from viewstate and control state.
4.VALIDATION
During validation, the validate method of all validation controls is called which sets the “IsValid” property of individual validator controls and of the page.
5.POSTBACK EVENT HANDLING:
If request is a postback, any of the event handlers is called. Page.IspostBack gets a value that indicates whether the page is being rendered for the first time or is being loaded in response to a postback.
6.RENDERING:
During rendering, viewstate is saved to the page and then the page calls on each control to contribute its rendered output to the output stream of Pages Response Property.
7.UNLOAD
Unload is called when page has been fully rendered, sent to the client and is ready to be discarded .At this point ,page properties such as response and request unloaded and any clean up is performed.