1.先建立BasePage.cs,继承自Page类
1 protected void Page_Load(object sender, System.EventArgs e)
2 {
3 if(!IsPostBack)
4 {
5 string name = strID;//Context.User.Identity.Name;
6 eMail.Text = DatabaseGateway.RetrieveAddress(name);
7 siteName.Text = "Microsoft-site";
8 //定义PageLoad事件
9 PageLoadEvent(sender, e);
10 }
11 }
2 {
3 if(!IsPostBack)
4 {
5 string name = strID;//Context.User.Identity.Name;
6 eMail.Text = DatabaseGateway.RetrieveAddress(name);
7 siteName.Text = "Microsoft-site";
8 //定义PageLoad事件
9 PageLoadEvent(sender, e);
10 }
11 }
2.页面的代码隐藏类继承自BasePage
1
public class Main :BasePage
2
{
3
protected System.Web.UI.WebControls.HyperLink HyperLink1;
4
protected System.Web.UI.WebControls.Label pageNumber;
5
//覆写BaePage的PageLoad事件
6
protected override void PageLoadEvent(object sender, System.EventArgs e)
7
{
8
pageNumber.Text = "第一页";
9
}
10
}
![](/Images/OutliningIndicators/None.gif)
2
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
3
![](/Images/OutliningIndicators/InBlock.gif)
4
![](/Images/OutliningIndicators/InBlock.gif)
5
![](/Images/OutliningIndicators/InBlock.gif)
6
![](/Images/OutliningIndicators/InBlock.gif)
7
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
8
![](/Images/OutliningIndicators/InBlock.gif)
9
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
10
![](/Images/OutliningIndicators/ExpandedBlockEnd.gif)