操作步骤:
- 在项目中创建文件lifeCycleValidation.aspx文件;
- 在文件lifeCycleValidation.aspx中添加代码,创建一个label控件,名字为lbText,代码如下:
<asp:Label ID=”lbText” runat=”server” Text=”Label”></asp:Label> |
3. 在lifeCycleValidation.aspx.cs中,添加如下代码:
protected void Page_Load(object sender, EventArgs e) { lbText.Text += "Page_Load<hr/>"; } protected void Page_PreRender(Object sender,EventArgs e) { lbText.Text += "Page_PreRender<hr/>"; } protected void Page_PreInit(object sender,EventArgs e) { lbText.Text += "Page_PreInit<hr/>";
} protected void Page_Init(object sender,EventArgs e) { lbText.Text += "Page_Init<hr/>"; } protected void Page_PreLoad(object sender,EventArgs e) { lbText.Text += "Page_PreLoad<hr/>"; }
|
执行效果图
注意:代码书写顺序并不影响程序的执行顺序。