Tuesday, December 9, 2008

Asp.Net Page Life Cycle

Asp.Net Page Life Cycle
Page life cycle is the cycle through which a page performs a series of processing steps

There are mainly 10 events in asp.net 2.0 page life cycle
1. PreInit(): In this event we set master page and themes property dynamically
and IsPostBack property is checked to determine whether this is a new request or postback request.
2.Init(): This is used to initialize control properities
3.InitComplete():This is used to perform tasks which need initialization be complete
4.PreLoad(): This is used to load viewstate for the page and its contents.
5.Load(): This is used to establish database connections and to set control properties
6.LoadComplete():This is used to Perform tasks which need loading be complete
7.PreRender():This is used to make final changes to the contents of page and its controls
8.SaveStateComplete():Before this event view state for the page and all its controls is saved.Any
changes to the page or controls in this event are ignored
9.Render():During this event page calls Render() method on all its controls that writes out the
controls markup that is sent to the browser.
10.Unload():This event occurs for each control and for the page. This is used to make final
cleanup for specific controls such as database connections

No comments: