Friday, 7 December 2012

Page life cycle in

General page life cycle stages:
1.       Page Request : - The  page request occur before the page life cycle begin .
2.       Start:- In the start, page properties such as request and response are set. At this stage , also determine whether the request is a postback or a new request and set’s ispostback  properties .this stage also set’s the uiculture properties .
3.       Initialization’s :- During the page initialization all controls are available and uniqueId properties of every control is set .A master page and theme are also apply in this stage if applicable .
4.       Load :- during the load , if the current request is postback   ,control properties are set with recover from viewstate and control state
5.       Post back event handling : - If the request is postback then control event handler are called , after the validate method for all validator control are called , which set’s the Isvalid property of all validator control .
6.       Rendering:- before rendering  viewstate of page and controls are saved. During the rendering  stage page call render method for every control of the page .
7.       Unload:- the unload event call after when the page is fully rendered ,sent to the client , and ready to discarded .
Life cycle event:
Within each stage of page life cycle , the page raised some events that you can use to run your own code .
1.       PreInit:- raised after the start stage has been complete and before initialization event raised .
Use this event for following :-
1.1   check is Ispostback .
1.2   create or re-create dynamic controls.
1.3   Set a master page dynamically .
1.4   Set theme property
1.5   Read or set profile property values.

2.       InIt:-  Raised after controls have been initialized and any skin setting has been applied . Use this event to read or initialize control properties .
3.       Initcomplete:- Raised at the end of the page initialization stage . Use this event to make changes to view state that you want to make sure persisted after the next post back .
4.       Preload:- Raised after the page loads view state for itself and all controls, and after it process post back data that is included with the request instance .
5.       Load:-  The page object call onload method on page object . use the onload event method to set properties in controls and establish the data base connection .
6.       Controls Event:- use this event to handle thre specific control event , such as button click event .
7.       Load Complete :- Raised at the end of the event handling stage .
8.       Pre Render : -Raised after the page object has created the all control that are required in order to render the page . Use this event to make final changes to the content of the  page .
9.       Pre Render complete :- Raised after data bound whose DataSourcdeId property set call its databind method .
10.   Save state complete:- Raised after the
11.   Unload:

No comments:

Post a Comment