public partial class Test : System.Web.UI.Page
{
private static int b;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Label1.Text = b.ToString();
}
}
protected void Button1_Click(object sender, EventArgs e)
{
b = b + 1;
Label1.Text = b.ToString(); }
}
一个lable,一个buttun, 谁能让label的值上到2啊???
{
private static int b;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Label1.Text = b.ToString();
}
}
protected void Button1_Click(object sender, EventArgs e)
{
b = b + 1;
Label1.Text = b.ToString(); }
}
一个lable,一个buttun, 谁能让label的值上到2啊???
不要说用static啊 ,如果用static 那请问你们怎么把label的值能到0 呵呵
{
private static int b=1;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Label1.Text = b.ToString();
}
}
protected void Button1_Click(object sender, EventArgs e)
{
b++;
//Label1.Text = b.ToString(); }
}
public partial class Test : System.Web.UI.Page
{
private static int b;
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
if(Session["bvalue"]==null)
b=1;
else
b = Convert.ToInt32(Session["bvalue"]);
b+=1;
Label1.Text = b.ToString();
Session["bvalue"]=b;
}
}
{
private static int b = 0;//赋值
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Label1.Text = b.ToString();
}
}
protected void Button1_Click(object sender, EventArgs e)
{
b = b + 1;
Label1.Text = b.ToString(); }
}