Skip to Content

TheBlogReaders.com

Salesforce.com, PHP, MySQL, Javascript, Ajax, Htacces

ASP.NET Life Cycle

Be First!
by December 1, 2015 ASP.Net

The Asp.Net page lifecycle is the most fundamental concept to understand to develop your applications. The whole page life cycle consists of some hard and fast rules called stages

asp.net life cycle

Control: Init
Page: Init
Page: InitComplete
Page: PreLoad
Page: Load
Control: Load
Page: LoadComplete
Page: PreRender
Control: PreRender
Page: PreRenderComplete
Page: SaveStateComplete
Page: RenderControl
Page: Render
Control: RenderControl
Control: Unload
Control: Dispose
Page: Unload
Page: Dispose

Asp.Net Page Life Cycle Events

These are simply illustrated as:

1.Preinit

This event occurs before the initialization of all the controls associated with the page as

well as before the theme being applied.

That’s why in many cases, we have to work on pre-init event when we want to write any

logic about the master page, themes, checking the IsPostBack property to check

whether the page has been processed for the first time.

2.Init

This event is the initialization of the page. All the visual aspects of the page (controls

initialization or theme application) are initialized in this event.

3. InitComplete

The name is obvious for this event. It occurs after the completion of the Init event. The

Viewstates of the controls are maintained between the init and initcomplete events.

Basically the viewstate for each control is turned on to keep the control’s values intact

even after we post back the page and flicker occurs.

4. Preload

In this event, the ViewState for the page as well as its controls is loaded.This event is

basically occurs when the page processes the data of the postback .

5. Load

The load event looks complex but it is not so complex. At this event, the page loads

itself and all the controls in it. The page load event basically loads the bound data from

the data sources to its controls and displays it.

6. Controls Events

Control events are the events of the controls .They provide the functionality to work

with the controls. For example, a button OnClick event normally posts back the whole

page with controls. A SelectedIndexChanged for the dropdown control is used to

perform several desired functions such as loading the data inside the GridView

7.LoadComplete

This event occurs when all the event handling is finished and all the controls are being

loaded.

8 .PreRender

This event gets raised after the page has created all controls for page rendering.

9. PrerenderComplete

This event is raised when the controls are loaded along with the data bounded to them

from the data sources when their DataBind() methods get invoked or called.

10. SaveStateComplete

This event is raised after both the view state and control state are saved for the page

and its controls.

11. Render

The Render may be defined well as a stage when the web server sends the markup to

the requesting browser to display its web page

12. Unload

This cleans up the page and controls. The unbinding of the controls and the freeing up

of the resources such as opened files are addressed at this event

 

(219)

Previous
Next

Leave a Reply