2
Visual Studio上的简单网站应用程序。我在设计中做了一个按钮。我希望每次点击它都会改变,但它只会改变一次。有人可以帮我解决吗?这是代码。如何记住C#web应用程序中按钮的状态?
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
bool click = false;
protected void button_Click(object sender, EventArgs e)
{
click = !click;
if (click == true)
butt.Text = "you clicked me!";
else
button.Text = "Click me again!";
}
}
它变成了"you clicked me!"
,之后没有变化。