正在阅读:带你走进ASP.NET(3)带你走进ASP.NET(3)

2009-03-12 23:34 出处:PConline 作者:飞鹰/ASPCool 责任编辑:ycx
从第一行中我们可以看出,该页面的后台代码全都在WebForm1.aspx.cs文件中。我们可以在这个文件中编写程序,如下所示: using System; using System.Collections; using System.ComponentModel; using System.Data; using System.Drawing; using System.Web; using System.Web.SessionState; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; namespace AspCool { /// /// Summary description for WebForm1. /// public class WebForm1 : System.Web.UI.Page { protected System.Web.UI.WebControls.TextBox TextBox1; protected System.Web.UI.WebControls.Button Button1; private void Page_Load(object sender, System.EventArgs e) { // Put user code to initialize the page here } #region Web Form Designer generated code override protected void OnInit(EventArgs e) { // // CODEGEN: This call is required by the ASP.NET Web Form Designer. // InitializeComponent(); base.OnInit(e); } /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.Button1.Click += new System.EventHandler(this.Button1_Click); this.Load += new System.EventHandler(this.Page_Load); } #endregion private void Button1_Click(object sender, System.EventArgs e) { } } } 通过代码后置,开发人员可以直接修改.cs文件(在Visual Basic.NET中是.vb文件)。而页面设计人员可以修改HTML页面,这样就大大简化了网站的建设过程。
键盘也能翻页,试试“← →”键

关注我们

最新资讯离线随时看 聊天吐槽赢奖品