【问题标题】:How to show Javascript Alert message before redirecting to same page in VB.NET?如何在重定向到 VB.NET 中的同一页面之前显示 Javascript 警报消息?
【发布时间】:2016-02-07 05:29:59
【问题描述】:

我尝试使用以下代码在按钮单击期间显示警报消息后重定向到同一页面。

ScriptManager.RegisterStartupScript(Me, Page.GetType(), "AlertMsg", "alert('Success');", True)
Response.Redirect(Request.Url.AbsoluteUri)

但页面重定向到同一页面而不抛出 Javascript 警报消息。如何解决这个问题?

【问题讨论】:

    标签: asp.net vb.net


    【解决方案1】:

    在提出问题之前..请查看已就相同主题提出的问题..这是stackoverflow..上的不同答案链接..

    How to get alert message before redirect a page

    Javascript Alert before redirecting in ASP.NET

    Asp.net Webform Display Alert and redirect

    【讨论】:

      【解决方案2】:
      ScriptManager.RegisterStartupScript(this,this.GetType(),"page redirect",
      "alert('Message'); window.location='" + 
      Request.Url.AbsoluteUri+"';",true);
      

      【讨论】:

        【解决方案3】:

        试试这个

        ScriptManager.RegisterStartupScript(Me, Me.[GetType](), "AlertMsg", "alert('Success');window.location ='"+Request.Url.AbsoluteUri+"';", True)
        

        【讨论】:

          猜你喜欢
          • 2018-07-29
          • 2012-01-24
          • 1970-01-01
          • 2013-08-20
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2018-07-20
          相关资源
          最近更新 更多