joe_pool_is Posted November 11, 2004 Posted November 11, 2004 After my ASP.NET page has successfully sent an email, I change my Lable to read: lblMessage.Text = "Email was successfully sent."That part is easy. But I would also like the page to redirect to my homepage after it displays the lblMessage to the user. How would I go about this? It would be perfect if I could add a waiting period to the Response.Redirect() command, but that does not seem possible. Quote Avoid Sears Home Improvement
eramgarden Posted November 12, 2004 Posted November 12, 2004 can u use Javascript to code the timer? after timer, redirect Quote
joe_pool_is Posted November 12, 2004 Author Posted November 12, 2004 or a meta refreshNever used a meta refresh. Care to show an example with some notes? As for using JavaScript, that would work great! BUT! How do I tell my VB.NET code to jump to some JavaScript code then return to the spot it was in my VB.NET code? My tasks are to 1) change a label message to "Message Sent" so my visitors know their message went through, then 2) redirect the page after about 4 seconds to the homepage. I've managed to get something to work. Instead of changing the label, I am currently redirecting the visitor to a ThankYou.htm page. That ThankYou.htm page has JavaScript in it that handles a redirect after 4 seconds. But, I'd rather have it all included on the same page, rather than have to include a separate page in my project just to handle the submittal notice. Ya know? Quote Avoid Sears Home Improvement
eramgarden Posted November 12, 2004 Posted November 12, 2004 cant you apply the same thing you've done in thankyou page to the you want ? Quote
joe_pool_is Posted November 12, 2004 Author Posted November 12, 2004 cant you apply the same thing you've done in thankyou page to the you want ?Maybe. Would someone mind telling me how to do that? That's what I'm here to try and find out! I don't know how to do it, and that's why I'm asking! Quote Avoid Sears Home Improvement
eramgarden Posted November 12, 2004 Posted November 12, 2004 well, you just said you implemented it for another page..how did you do it? cant you use the same code?? Quote
HJB417 Posted November 13, 2004 Posted November 13, 2004 Never used a meta refresh. Care to show an example with some notes? scroll down to the examples Quote
joe_pool_is Posted November 13, 2004 Author Posted November 13, 2004 well' date=' you just said you implemented it for another page..how did you do it? cant you use the same code??[/quote']What I want is something that works within my Button_Click() subroutine:Mail.Send() lblMessage.Text = "Email was sent." ' The Holy Grail I seek below gives visitors time to read the message above before the Redirect... Wait4Seconds() Response.Redirect(strHomepage)What I had to use was something like this:Mail.Send Response.Redirect("OK.htm")where the code in the OK.htm page is:<html> <head> <title>OK</title> <script language="javascript"> function jsTimer() { window.setTimeout("jsReload();", 4000); } function jsReload() { window.location = "[url="http://www.mywebsite.com/"]http://www.myWebsite.com/[/url]"; } </script> </head> <body onload="jsTimer();"> <p align=center><b>Email sent.</b></p> </body> </html> The second version works, but I don't understand how to call JavaScript code from within VB.NET code, then have execution return to VB.NET. Can you see an obvious way to do this? It would simplify my project by removing one page. Quote Avoid Sears Home Improvement
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.