I am writing this blog because one of my friends asked me to write on this very important phase of asp.net programming. This is very hot question asked during interview.
Here I am explaining all the phases of ASP.NET page life cycle step by step and I also tried to show what happen in every phase of page life cycle.
Page_Init |
Page Initialization |
LoadViewState |
View State Loading |
LoadPostData |
Postback Data Processing |
Page_Load |
Page Loading |
RaisePostDataChangedEvent |
PostBack Change Notification |
RaisePostBackEvent |
PostBack Event Handling |
Page_PreRender |
Page Pre Rendering Phase |
SaveViewState |
View State Saving |
Page_Render |
Page Rendering |
Page_Unload |
Page Unloading |
Now see what happen in real life
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- namespace WebApplication1
- {
- public partial class _Default: Page
- {
- protected void Page_PreInit(object sender, EventArgs e) {
-
-
-
-
-
- }
- protected void Page_Init(object sender, EventArgs e) {
-
-
- }
- protected void Page_InitComplete(object sender, EventArgs e) {
-
- }
- protected void Page_Preload(object sender, EventArgs e) {
-
-
-
- }
- protected void Page_Load(object sender, EventArgs e) {
-
-
-
-
-
-
- }
- protected void Page_LoadComplete(object sender, EventArgs e) {
-
- }
- protected void Page_PreRender(object sender, EventArgs e) {
-
-
-
-
-
-
-
-
-
- }
- protected override void OnSaveStateComplete(EventArgs e) {
-
-
-
-
- }
-
-
-
-
- protected void Page_UnLoad(object sender, EventArgs e) {
-
-
-
-
-
-
- }
- }
- }