page lifecycle


Published on

ASP.NET page life cycle's stages and fired events in each stages.

Published in: Education, Technology
  • Be the first to comment

  • Be the first to like this

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide page lifecycle

  1. 1. ASP.NET JUMP START SESSION - 3 Abu Md. Khademul Basher Speaker TechForum, Microsoft Technical Community
  2. 2. MY PUBLISHED ARTICLE IN CODE PROJECT  Implementation of MVC Patterns in ASP.NET Web forms Application.  MVC Patterns (Active and Passive Model) and its implementation using ASP.NET Web forms  Easy way to learn the Asp.Net Built in Membership and Role using custom controls with example  Single Page Application performing database CRUD operations using Backbone and ASP.NET Web API  Apply Here Map in Windows Phone HTML5 Apps
  4. 4. CONTENTS  ASP.NET Page Life Cycle
  5. 5. ASP.NET PAGE LIFE CYCLE What is page life cycle? When a page is requested by the user the request goes through a series of steps. The periods between the request and response of a page is called Page Life Cycle.  Request- Start of life cycle (send by user).  Response – End of life cycle (send by server).
  6. 6. ASP.NET PAGE LIFE CYCLE How to initiate a request? When you type a url in Browser address bar and press enter, the Browser sent a page request to the Server. The sequence diagram of request and response.
  7. 7. ASP.NET PAGE LIFE CYCLE HTTP Methods:  GET - Requests data from a specified resource  POST - Submits data to be processed to a specified resource <form method="post" runat="server"> <a href=“”>Google</a> <input type=“text” value=“”/> <input type=“button” value=“Submit”/> </form>
  8. 8. GENERAL PAGE LIFE-CYCLE STAGES When a page is requested, it goes through the following stages. Page request Start The page request occurs before the page life cycle begins. Page initialization Load Validation Postback event handling Rendering Unload In the start step, page properties such as Request and Response are set. During page initialization, controls on the page are available and each control's UniqueID property is set.Control properties are loaded with information recovered from view state and control state. Validate method of all validator controls is called. If the request is a postback, any event handlers are called. During the rendering phase, the page calls the Render method for each control.Unload is called after the page has been fully rendered
  9. 9. GENERAL PAGE LIFE-CYCLE STAGES Events rises within each stage of the life cycle and there’s corresponding event handlers are as follows: Page Event Handler Stage PreInit Page_PreInit Page initialization Init Page_Init Page initialization InitComplete Page_InitComplete Page initialization PreLoad Page_PreLoad Load Load Page_Load Load Control events ddlCoungry_SelectedIndex Changed Load LoadComplete Page_LoadComplete Load PreRender Page_PreRender Rendering SaveStateComplete Page_SaveStateComplete Rendering Render (Method) Render Rendering Unload Page_Unload Unload
  10. 10. GENERAL PAGE LIFE-CYCLE STAGES…. Flow Chart view of Page Life Cycle. Initialize Method: OnInit No Yes Load View State Process postback data Load method: Onload First Load? First Load? No Yes Handle postback events method: RaisePostBackEvent Prer ender method: OnPreRender Save view state method: SaveViewState Render method: Render Dispose method: Dispose
  11. 11. THANK YOU
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.