ASP.Net Page Life Cycle

How page life cycle works in asp.net?
  • Page request:
            This is a stage before page life cycle starts. This step happens when user sends request for page. ASP.Net decides whether to parse and compile the requested page or just catched verions of page need to be send in response.
  • Start:
           In this step page request and response properties get set. Also page determines whether it is a page post back ot it is a new request and based on that sets IsPostBack() property value and also sets UICulture.
  • Page Initialization:
         In this step all the controls on page a available and each controls unique Id's get set. Also themes get set. But data is not loaded for the controls and control property values are not restored from viewstate.
  • Page load:
        In this step if request is a postback request then dat get loaded fro controls from viewstate and control state.
  • Validation:
        In this step Validate method of all valiation controls get called and it sets IsValid property of each individual validator control and of the page.
  • Postback event handling:
          If reuest is a postback, event handlers get called.
  • Rendering:
           In this step, page calls render method for each control and writes output to page response proerty. Before Rendering viewsate get saved for page and all it's controls.
  • Unload:
           This step happens when page and it's controls are fully loaded and sent to the client and ready to be discarded. Page properties like Response and Request are unloaded at this phase.

0 Comments :

Post a Comment