一直一来对 页面生命周期都很模糊,在学校时就学了一点点,后来也没有写,平时工作中只用到了一个 Page_Load
其他的就不知道了, 今天在园子里看到一个园主写的内容不错,就引用过来了。
protected void Page_PreInit(object sender, EventArgs e)
{
Response.Write("Page_PreInit<br/>");
}
protected void Page_Init(object sender, EventArgs e)
{
Response.Write("Page_Init<br/>");
}
protected void Page_InitComplete(object sender, EventArgs e)
{
Response.Write("Page_InitComplete<br/>");
}
protected void Page_PreLoad(object sender, EventArgs e)
{
Response.Write("Page_PreLoad<br/>");
}
protected void Page_Load(object sender, EventArgs e)
{
Response.Write("Page_Load<br/>");
}
protected void Page_LoadComplete(object sender, EventArgs e)
{
Response.Write("Page_LoadComplete<br/>");
}
protected void Page_PreRender(object sender, EventArgs e)
{
Response.Write("Page_PreRender<br/>");
}
protected void Page_SaveStateComplete(object sender, EventArgs e)
{
Response.Write("Page_SaveStateComplete<br/>");
}
protected void Page_Unload(object sender, EventArgs e)
{
int i = 0;
i++;//这行代码是用来设置断点的,为什么不用Response.Write?你说呢?
}
protected void Button1_Click(object sender, EventArgs e)
{
Label1.Text = "ControlEvent";
Response.Write("Button事件触发!<br/>");
}
放在页面里面就会看到页面生命周期是怎么执行的了