ASP.NET Page Life Cycle Overview


           ASP.Net Page Life Cycle

  
       Page Life cycle in asp.net means the various stages of the webpage will undergo with in IIS
Once the page request is submitted to server.

    There are overall 8 stages available for any webpage that will undergo with in server at page life cycle.

1)Page Request
2)Start
3)Page Intialization
4)Load
5)validation
6)PostBack Event Handling
7)Rendering
8)Unload

1)Page Request:-

          The page request will occur before the page life cycle begins,when the page is requested by the user asp.net run time will determine whether cached version of the page should be sent to client (or) page should be generated.

2)start:-

       During this stage properties for a page like request,Response are set
At this stage,page also determines whether the request is first request/postback request and Ispostback property will set accordingly.

3)PageIntialization:-

       At this stage all the controls of the page are available and unique Id property of every control will be set.

4)Load:-

             During this stage all controls,properties will be loaded into the memory,properties values will be taken from code(or) recovered from viewstate

5)Validation:-
     
       During this stage validate method of all validation controls is called,Isvalid property will be set accordingly for this control and also from the page.

6)PostBackEvent Handling:-

         During this stage the controls postbackEvent will be fired by using which postBack of the page is caused.

7)Rendering:-

          Before rendering state for every control and view state for the page are saved
Render method will be called for every control and for the page then complete code id converted clientside  understandable from then result is delivered to client.

8)Unload:-

           Unload is called once the complete result is delivered to client.
During this stage the objects are completely destroyed for all controls as well as for the page and meomroy is released.



Events associated with PageLifeCycle:-

1)PreInit:-

         Use this event to perform the following tasks.
a)To check the request first request or postback request
b)to crate or recreate controls dynamically

2)Init:-

     This event is fired after all controls have been initialized use this event to perform the following task.
a)to read the control properties or to initialize the control properties

3)InitComplete:-

     This event is raised by the page object. Use this event for processing any kind of task that requires after all initialization is completed.

4)PreLoad:-

       Use this event to perform any kind of processing before the load event.

5)Load:-

       During this event first runtime will call load method for all the child controls to parent controls to load complete properties and data.
Use this event to perform the following 

tasks:-
1)To set/get this control property values
2)to establish connections etc

6)Control Event:-

         Use this event to perform the specifc task based on the requirements
This events are like button_click ,textbox_textchanged,Radiobutton_checkedchaanged ..etc

7)Load complete:-

    Use this event to perform the tasks that requires after all the controls on the page are loaded

8)Prerender:-

      In general this event will be fired for each control of the page.
Use this event to make any final changes that are required to be performed for the controls(or) for this page.

9)Savestate complete:-

       Before this event viewstate has been saved for the page and for all the controls.

Use this events to perform any task is be saved into viewstate.
Share on Google Plus

About Unknown

    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment