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

弹出对话框和跳转页面的次序问题?
我点击“注册”按钮后,希望先跳出一个“注册成功”的对话框,再跳转页面。

但是只要有跳转页面,弹出对话框的代码放在再前面也不行,总是不弹出来。请问有什么解决方法呢?

protected void Button_Click(object sender, EventArgs e)
{
  Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('注册成功');", true);
  Response.Redirect("service.aspx");



------解决方案--------------------
C# code

Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('注册成功');location.href='service.aspx'", true);

------解决方案--------------------
protected void Button_Click(object sender, EventArgs e)
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('注册成功');location.href='service.aspx';", true);}

------解决方案--------------------
你的Button_Click事件是服务器控件的事件吧.
回postback的,当前页回完,service.aspx响应完,
才能转过去.足够慢的时候,像死机.