.net页面加载顺序
2010-07-05 09:51 通心菜 阅读(623) 评论(0) 编辑 收藏 举报protected void Page_Load(object sender, EventArgs e)
{
Response.Write(count + "Page_Load <br />");
count++;
}
protected override void OnPreInit(EventArgs e)
{
base.OnPreInit(e);
Response.Write(count + "OnPreInit <br />");
count++;
}
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
Response.Write(count + "OnInit <br />");
count++;
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
Response.Write(count + "OnLoad <br />");
count++;
}
protected override void OnPreLoad(EventArgs e)
{
base.OnPreLoad(e);
Response.Write(count + "OnPreLoad <br />");
count++;
}
protected override void OnLoadComplete(EventArgs e)
{
base.OnLoadComplete(e);
Response.Write(count + "OnLoadComplete <br />");
count++;
}
protected override void OnInitComplete(EventArgs e)
{
base.OnInitComplete(e);
Response.Write(count + "OnInitComplete <br />");
count++;
}
protected override void OnUnload(EventArgs e)
{
base.OnUnload(e);
}
protected override void OnDataBinding(EventArgs e)
{
base.OnDataBinding(e);
Response.Write(count + "OnDataBinding <br />");
count++;
}
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
Response.Write(count + "OnPreRender <br />");
count++;
}
结果:
0OnPreInit
1OnInit
2OnInitComplete
3OnPreLoad
4Page_Load
5OnLoad
6OnLoadComplete
7OnPreRender