conditionally run Javascript alert

  • Thread starter Thread starter Seth Williams
  • Start date Start date
S

Seth Williams

In the middle of my event handler (for a button), I have an if/then
statement (using vb.net):
if (whatever) then
strScript="<script .......
strScript &= alert('This is an alert')
strscript &="</script>
' this is all an abbreviated script - - but you get the idea
response.write(strscript)
end if
response.redirect("another page.aspx")

the problem is that, with the Response.redirect after the if/then statement,
it skips the javascript alert and goes to the redirect
if I comment out the reponse.redirect, the javascript alert pops up fine

where am I going wrong?
 
You need to put your alert on the page you are redirecting to. By adding a
querystring "hasAlert" or something, you can check to see if you need to show
the alert on the next page.
 
Back
Top