在“edmx”页面中,我有带有事件“NextButton_Click”的按钮控件进行点击。当我单击此按钮时,变量“index”不想更改为“40”,“text”变量不想更改为“active”。这些变量总是处于相同的状态,“text”总是等于“start”,“index”总是等于“10”。为什么他们不想改变 (index = 40; text = "active";) 正如我在点击按钮事件方法中所写的那样?
public partial class CountriesTowns : System.Web.UI.Page
{
int index = 10;
string text = "start";
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
index = 20;
text = "stop";
}
}
//click next button
protected void NextButton_Click(object sender, EventArgs e)
{
Response.Write(index);
Response.Write(text);
index = 40;
text = "active";
}