0

I want the message box popup and after display user click OK then it will redirect to the target page. The problem is it will directly go to the target page without display the popup message. I have tried all coding that I've found but still doesn't function. Please check my coding if there is something missing tq.

Try
        ......

        da1.Fill(ds, "Student")
        da2.Fill(ds, "StudentAccess")
        Validate()

        ClientScript.RegisterStartupScript(Me.GetType(), "AlertMessageBox", "alert('Your Data Has Been Saved, Thank You for Register.');", True)

        Response.Redirect("Verify.aspx")
        con.Close()

    Catch ex As Exception
        ClientScript.RegisterStartupScript(Me.GetType(), "AlertMessageBox", "alert('Error');", True)
    End Try
Dmitry Pavliv
  • 35,333
  • 13
  • 79
  • 80
user3642193
  • 3
  • 1
  • 2
  • ClientScript will not work for this, you need to use Modal popups and on there you can give a button, on its click event it will Response.Redirect to your "Verify.aspx" page. – Krunal Patil May 24 '14 at 11:18
  • A. i would downvote your post but i need 125 rep B. don't use msgbox/aert, they are blocked on IE versions after 6.x or something, and other browsers. C. use a custom usercontrol, or some JS client side that pops a div on the page, with a button, which submits the form, which then gets validated, etc... – porkchop May 24 '14 at 11:23
  • @porkchop In most browsers, including IE 6.0 and above, a JavaScript `alert` is allowed under default settings. It is worth mentioning, however, that most browsers include an option to turn JavaScript off. [Progressive Enhancement](http://en.wikipedia.org/wiki/Progressive_enhancement) helps in this situation. – Sean Airey May 24 '14 at 11:34
  • Perhaps the answers to this question will help: http://stackoverflow.com/questions/4227043/how-do-i-cancel-form-submission-in-submit-button-onclick-event – Sean Airey May 24 '14 at 11:39
  • @Sean, my apologies then, been a while since i did asp.net dev. i would use the form method though. – porkchop May 24 '14 at 11:59

0 Answers0