Index.aspx
<%@ Page language="c#" Codebehind="index.aspx.cs" AutoEventWireup="false" Inherits="wab.index" %>
<form id="index" method="post" runat="server">
<asp:DataGrid id="contacts" runat="server" Width="492px" Height="104px"></asp:DataGrid>
</form>
index.aspx.cs(继承自定义类PageBase)
public class index : PageBase
{
protected System.Web.UI.WebControls.DataGrid contacts;
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN:该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
}
newContact.aspx
<%@ Page language="c#" Codebehind="newContact.aspx.cs" AutoEventWireup="false" Inherits="wab.newContact" %>
<form id="newContact" method="post" runat="server">
<P><FONT face="宋体">名子</FONT>
<asp:TextBox id="TextBox1" runat="server"></asp:TextBox></P>
<P><FONT face="宋体">姓氏</FONT>
<asp:TextBox id="TextBox2" runat="server"></asp:TextBox></P>
<P>
<asp:Button id="Button1" runat="server" Text="Button"></asp:Button></P>
</form>
newContact.aspx.cs(继承自定类PageBase)
public class newContact : PageBase
{
protected System.Web.UI.WebControls.TextBox TextBox1;
protected System.Web.UI.WebControls.Button Button1;
protected System.Web.UI.WebControls.TextBox TextBox2;
private void Page_Load(object sender, System.EventArgs e)
{
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN:该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
} |