提示訊息後並轉到新頁面

摘要:提示訊息後並轉到新頁面

 

 

Function ShowMessage(ByVal Page As System.Web.UI.Page, ByVal Message As String, ByVal Redirect As String)
        Dim JavaScript As String
        JavaScript = "<SCRIPT Language='JavaScript'>"
        JavaScript += "window.alert('"
        JavaScript += Message & "');"
        JavaScript += "document.location='" & Redirect & "';"
        JavaScript += "</SCRIPT>"
        Page.RegisterStartupScript("", JavaScript)
 End Function

例如:   

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
       'Update SQL成功後轉到奇摩
        ShowMessage(Page, "修改成功", " http://www.kimo.com.tw")
End Sub