Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / March 2008

Tip: Looking for answers? Try searching our database.

conditionally run Javascript alert

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Seth Williams - 18 Mar 2008 21:31 GMT
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?
Mike Collins - 18 Mar 2008 22:03 GMT
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.

> In the middle of my event handler (for a button), I have an if/then
> statement (using vb.net):
[quoted text clipped - 12 lines]
>
> where am I going wrong?
Teemu Keiski - 19 Mar 2008 13:13 GMT
Or you can do the redirect in javascript with location.href='yourpage.aspx'

Signature

Teemu Keiski
AspInsider, ASP.NET MVP
http://blogs.aspadvice.com/joteke
http://teemukeiski.net

> In the middle of my event handler (for a button), I have an if/then
> statement (using vb.net):
[quoted text clipped - 12 lines]
>
> where am I going wrong?

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.