conditionally run Javascript alert

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?
 
M

Mike Collins

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top