各個頁面的生命週期以及順序
protected void Page_PreRender(object sender, EventArgs e)
{
Response.Write("MasterPage Page_PreRender 事件<br/>");
}
protected void Page_PreRenderComplete(object sender, EventArgs e)
{
Response.Write("MasterPage Page_PreRenderComplete 事件<br/>");
}
protected void Page_PreInit(object sender, EventArgs e)
{
Response.Write("MasterPage Page_PreInit 事件<br/>");
}
protected void Page_Init(object sender, EventArgs e)
{
Response.Write("MasterPage Page_Init 事件<br/>");
}
protected void Page_InitComplete(object sender, EventArgs e)
{
Response.Write("MasterPage Page_InitComplete 事件<br/>");
}
protected void Page_PreLoad(object sender, EventArgs e)
{
Response.Write("MasterPage Page_PreLoad 事件<br/>");
}
protected void Page_Load(object sender, EventArgs e)
{
Response.Write("MasterPage Page_Load 事件<br/>");
}
protected void Page_LoadComplete(object sender, EventArgs e)
{
Response.Write("MasterPage Page_LoadComplete 事件<br/>");
}
執行網頁看看印出的結果如下
如果ASPX網頁有加入了MasterPage 結果如下