When you run asp.net page, page goes through
life cycle in which performs series of steps.
General page life cycle goes with following
When ASP.NET gets a page request, it
decides whether to parse and compile the page, or there would be a cached
version of the page; accordingly the response is sent.
In the start stage, page properties
such as Request and 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. The page also sets the UICulture property.
At this stage, the controls on the
page are assigned unique ID by setting the UniqueID property and the themes are
applied. For a new request, postback data is loaded and the control properties
are restored to the view-state values.
At this stage if current request is post
back, control properties are set using the view state and control state values.
If the request is a postback, control
event handlers are called. After that, the Validate method of all validator
controls is called, which sets the IsValid property of individual validator
controls and of the page. (There is an exception to this sequence: the handler
for the event that caused validation is called after validation.)
At this stage, view state for the page
and all controls are saved. The page calls the Render method for each control
and the output of rendering is written to the OutputStream class of the
Response property of page.
The Unload event is raised after the
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 are unloaded and
cleanup is performed.