Redirecting to a page after clicking OK in confirmation box in asp.net VB

I have an if condition on a button which redirects to another page. I want a confirmation box to pop up if the condition is true. If the user clicks ok on the box he should be redirecting to the page else not. I am not that good with Java script. I just tried to develop something on the following lines but nothing seems to work. Any help in this regard would be much appreciated. I am working in Asp.net on the client side and VB

Dim sb As New System.Text.StringBuilder()

        sb.Append("<script type = 'text/javascript'>")
        sb.Append("window.onload=function(){")
        sb.Append("if (confirm('")
        sb.Append(message)
        sb.Append("'))};")
        sb.Append(Response.redirect)
        sb.Append("</script>")
        ClientScript.RegisterClientScriptBlock(Me.GetType(), "confirm", sb.ToString())

Replace:

sb.Append("'))};")
sb.Append(Response.redirect)
sb.Append("</script>")

With:

sb.Append("')){")
sb.Append("window.location = 'http://domain/page.aspx';")
sb.Append("}};</script>")
链接地址: http://www.djcxy.com/p/71538.html

上一篇: 登录页面不会重定向到asp.net mysql中的报告页面

下一篇: 在asp.net VB中的确认框中单击确定后重定向到一个页面