I use following code-behind for javascript pop up for conforming, it works well but it does redirect the user to TestPage.aspx always regardless of user selection whether Yes or No.
lblMsg.InnerHtml = @"
<script type='text/javascript'>
confirm('Do you want to continue?');
window.location='TestPage.aspx?ID=" + Request.QueryString["ID"].ToString() + "&txtTest=" + Server.UrlEncode(txtTest.Text) + strSomeString + "'
</script>";
Any idea?
And I use this, this time there is no pop up even.
lblMsg.InnerHtml = @"
<script type='text/javascript'>
confirm('Do you want to continue?');
window.location='TestPage.aspx?ID=" + Request.QueryString["ID"].ToString() + "&txtTest=" + Server.UrlEncode(txtTest.Text) + strSomeString + "'; return false;
</script>";
You might try:
The
confirmfunction returns a bool depending on whether or not the user confirmed the choice. You can use that to redirect to the next page only if necessary.