如何觉得刷新问题???
blufo 2007-04-06 10:27:48 执行以下代码时如果刷新CLICK事件会再次执行!!!请问如何避免网页刷新时再次提交数据呢?
谢谢~~ ·_·
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Response.Write("第一次\n");
Session["b"] = "a";
}
else
{
Response.Write("第二次");
}
}
bool flag = false;
protected void Button1_Click(object sender, EventArgs e)
{
Session["b"] += "提交一次";
Response.Write(Session["b"].ToString());
flag = true;
Show();
flag = false;
}
protected void Show()
{
if (flag)
{
//Response.Write("操作一次数据库");
Session["b"] += "插入一次";
}
}