62,025
社区成员
发帖
与我相关
我的任务
分享
protected void Page_Load(object sender, EventArgs e)
{
if (this.txtSearch1.Text == "OnLoad")
{
this.txtSearch1.Text = "Page_Load后加载";
}
else
{
txtSearch1.Text = "Page_Load";
}
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e); // 放在前面,先执行Page_Load
if (this.txtSearch1.Text == "Page_Load")
{
this.txtSearch1.Text = "OnLoad后加载";
}
else
{
txtSearch1.Text = "OnLoad";
}
//base.OnLoad(e); // 放在后面,后执行Page_Load
//不调用base.OnLoad(e),不执行Page_Load
}