我怪!我怪!我怪怪怪!奇怪的传值?
蓝海战术 2002-12-10 05:16:56 运行后输入值给TextBox1,点击命令执行Button1_Click后给kk,但离开Button1_Click语句块后kk的值却为空了???也就是点击命令执行Button2_Click后Label1.Text却为空,不信你试试??请问为什么?如何来传值?(不要直接传)
namespace WebApplication11
{
/// <summary>
/// WebForm1 的摘要说明。
/// </summary>
public class WebForm1 : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Label Label1;
protected System.Web.UI.WebControls.TextBox TextBox1;
protected System.Web.UI.WebControls.Button Button1;
protected System.Web.UI.WebControls.Button Button2;
string kk;
.............
private void Button1_Click(object sender, em.EventArgs e)
{
kk=TextBox1.Text ;
}
private void Button2_Click(object sender, em.EventArgs e)
{
Label1.Text =kk;
}
}
}