日期:2014-05-17  浏览次数:20432 次

当页面中有多个button控件里,为什么会出现这样的问题?
protected void Button2_Click(object sender, EventArgs e)
  {
  updatepeople();
  //Response.Redirect("Default.aspx");
   
  }
  protected void Button3_Click(object sender, EventArgs e)
  {
  updatenumber();
  //Response.Redirect("Default.aspx");

  }

就是点按钮2需要第二次才执行,点按钮3时第一次会先执行一下按钮2,然后从第二次开始才执行按钮3。使用Response.Redirect("Default.aspx");
后功能变正常,但是每次点后会跑到网页最上面去,不方便继续点按钮。

------解决方案--------------------
但你updatexxxx()的时候,为什么不立刻更新界面呢?难道都要等到下一个页面再次回发时才更新界面,这当然看起来是要慢一个周期啦!
------解决方案--------------------
Response.Redirect("Default.aspx");这个用了是重定向本页,相当于刷新。
你要不刷新达成效果,就需要用一些前台控件,ajax来做了。