一个TextBox1,一个Button1,在Page_Load里 赋值 ,更改TextBox1里的值,点按钮时取值.发现在还是"1234"...求解..
protected void Page_Load(object sender, EventArgs e)
{
TextBox1.Text = "1234";
} protected void Button1_Click(object sender, EventArgs e)
{
string aaa = TextBox1.Text;
Response.Write(aaa);
}
protected void Page_Load(object sender, EventArgs e)
{
TextBox1.Text = "1234";
} protected void Button1_Click(object sender, EventArgs e)
{
string aaa = TextBox1.Text;
Response.Write(aaa);
}
{
TextBox1.Text = "1234";}
{
if(!IsPostBack)TextBox1.Text = "1234";
} protected void Button1_Click(object sender, EventArgs e)
{
string aaa = TextBox1.Text;
Response.Write(aaa);
}
点击按钮页面回传重新赋值
protected void Page_Load(object sender, EventArgs e)
{ if(!IsPostback) //如果不加这个话,就会这样
TextBox1.Text = "1234";
}
protected void Page_Load(object sender, EventArgs e)
{ if(!IsPostback)
{
TextBox1.Text = "1234";
} }