asp.net webform 变量存储问题
int i = 0;
protected void chk_CheckedChanged(object sender, EventArgs e)
{
i++;
TextBox1.Text = i.ToString();
}
以上方法我想实现执行 chk_CheckedChanged 方法 i进行累加 可是 TextBox1输出总是1 因为每次都执行了 int i = 0;
如果 static int i= 0; 等下次打开网页的时候 i的值依然存储的是上次累加的值 不能从0开始累加
怎么办?