TextBox控件的Text属性在Page_Load()函数中被初始化后,就无法通过输入改变它的值了,这是怎么回事?
以下内容为程序代码:
protected void Page_Load(object sender, EventArgs e)
{
TextBox1.Text = "111111111";
TextBox2.Text = "222222222"; } protected void Button1_Click(object sender, EventArgs e)
{
string s = "";
string n = "";
s = TextBox2.Text;
n = TextBox1.Text;
Response.Write(s+n);
}
无论在webform中如何输入,输出结果总是:111111111,2222222222
但我想改变textBox的初始值,赋给在网页上输入的值.怎么做?
以下内容为程序代码:
protected void Page_Load(object sender, EventArgs e)
{
TextBox1.Text = "111111111";
TextBox2.Text = "222222222"; } protected void Button1_Click(object sender, EventArgs e)
{
string s = "";
string n = "";
s = TextBox2.Text;
n = TextBox1.Text;
Response.Write(s+n);
}
无论在webform中如何输入,输出结果总是:111111111,2222222222
但我想改变textBox的初始值,赋给在网页上输入的值.怎么做?
{
if (!IsPostBack)
{
TextBox1.Text = "111111111";
TextBox2.Text = "222222222";
} }