using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class Default2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
///
/// 写入html控件text1(input) Text1定义部分加入“runat="server"”
///
/// 在服务器端虽然 “Text1.Value”不能自动识别,但可以正确运行
///
///
///
protected void Button1_Click(object sender, EventArgs e)
{
Text1.Value = "999";
}
///
/// 读取html控件text1(input)的值
///
///
///
protected void Button2_Click(object sender, EventArgs e)
{
this.TextBox1.Text = Request.Form["Text1"].ToString();
}
}
asp.net 2.0服务器控件(html服务器控件和web服务器控件)是否必须需要放在
的标记之中,可以根据需要进行设置,大多数情况下,对于只用来进行界面显示的控件、并且不需要处理事件的控件,可以不放在之间,对于大多数控件来说,是要在服务器端进行事件处理和获得某些返回值的,因此需要放在之间。作者:段利庆 QQ:14035344