页面生命周期

页面pr方法内部处理过程:
第一步:根据Form里面的请求内容(ViewState)确定是否是IsPostBack
第二步:页面初始化之前
this.PerformPreInit()
{
this.OnPreInit(EventArgs.Empty);//一般在这里面设置主题,加载模版由
this.InitializeThemes();//初始化主题,如果已经设置主题直接退出,如果没有设置根据配置来
this.ApplyMasterPage();设置模版页,如果模版页已经存在(如在OnInit代码里面设置了新的模版页就不走原来的了 就结束了)

第三步:
OnInit()执行
this.OninitaComplete(EventArgs.Empty);初始化结束
第四步:处理回发数据
this.LoadAllState();//加载所有的ViewState:page以及控件的
this.ProcessPostData(this._requestValueCollection,true)//处理回发数据,就看一下哪个控件变化了,然后调用先发的方法
第五步:
this.OnPreLoad(EventArgs.Empty)
第六步:
Onload()
this.LoadRecursive();

第七步:
this.ProcessPostData(this._leftoverPostData,false);
this.RaiseChangedEvents();
this.RaisePostBackEvent(this._requestValueCollection);
第八步:
this.OnLoadComplete(EventArgs.Empty);
第十步:
this.PrepareCallback(allbackControlID);
this.PreRenderRecursiveInternal();
this.SaveAllStare();
this.OnSaveStareComplete(EventArgs.Empty);
this.RenderControl(this.CreateHtmlTextWriter(this.Response.Otput))

this._context.ApplicationInstance.Completeresquest();

原文地址:https://www.cnblogs.com/wohaoxue/p/3999911.html