基类PageBase
public class PageBase:System.Web.UI.Page
{
private void Page_Load(object sender, System.EventArgs e)
{
Response.Write("this is pageBase");
Response.Write("<br>");
}
override protected void OnInit(EventArgs e)
{
InitializeComponent();
base.OnInit(e);
}
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
}
}
页面Default.aspx继承PageBase
public partial class _Default :PageBase
{
protected void Page_Load(object sender, EventArgs e)
{
Response.Write("this is default");
Response.Write("<br>");
}
}
页面输出的内容如下:
this is default
this is pageBase
为什么先执行Default的Page_Load,而不是先执行基类PageBase 的Load事件?
呼如林