Display alert messagebox before redirect

Hi all, I’m having a VB Sub function that displays a message box followed by a response.redirect. My problem is that the response.redirect occurs instantly without the alert message box being displayed or any length of time.

I want the user to be able to click OK on the messagebox, as they would if the response.redirect isn’t there, before the response.redirect fires.

What should I do?

Redirect the page using javascript rather than back-end code. Or use an Ajax Toolkit modal popup to behave like your alert box.

Oi, why didn’t I think of that ?

Response.Write(“<script>alert(‘message’) ; location.href=‘nextpage.aspx’</script>”)


you could always use the ajaxcontroltoolkit ConfirmButton


I think
Response.Write(“<script>alert(‘message’) ; window.location.href=‘nextpage.aspx’</script>”) ;
is okay as you can show it in accordance with the conditions.

Aside from using Response.Write, it should be fine.