ASP.NET Page Life CycleAt the point when a page is requested for, it is executed into the server memory, handled, and sent to the program. Later it is unloaded from the memory. In between at every stage, techniques and events are accessible, which could be rejected or canceled by need of the application. Rather, you can compose a manual particular code to reject the default code.
The Page class makes a tree arranged in order of ranks, of all the controls on the page. All the elements of the page beside the directives, are a part of this control tree.
You can see the control tree by including trace= “valid” to the page mandate. We will cover page directives and following under “directives” and ‘event handling’.
The page life cycle stages are:
- Initialization
- Creation of the controls on the page
- Rebuilding and support of the state.
exec. of the event handler codes
- Page rendering
A thorough tutorial of Page cycle proves benificial in any stage of page life cycle. Exec of Page Life Study can help in solving all errors in between any stage of Page Life. This Tutirial additionally helps in creating custom controls and executing them at ideal time, generate their properties with perspective state information and run control behaviour code.
Taking after are the distinctive phases of an ASP.NET page:
- Page request
When ASP.NET gets a page demand, it chooses whether to parse and order
the page, or there would be a cached version of the page; in like manner the reaction is sent.
- Beginning of page life cycle
At this stage, the Request and Response objects are set. In the event that
the request is an old demand or post back, the IsPostBack property of the page is set to genuine.
The UICulture property of the page is additionally set.
- Page initialization
At this stage, the controls on the page are relegated unique ID by setting the
UniqueID property and the themes are applied. For another requests, postback information is
stacked and the control properties are reestablished to the view-state values.
- Page load
At this stage, control properties are set to utilize the view state and control state
values.
- Validation
Validate technique for the approval control is called and on its fruitful exec
, the
IsValid property of the page is set to genuine.
- Postback occasion handling
If the request is a postback (old demand), the related event
handler is appealed
- Page rendering
At this stage, view state for the page and all controls are spared. The page calls the
Render technique for every control and the yield of rendering is composed to the OutputStream class
of the Response property of page.