Another Timer question

joe_pool_is

Contributor
Joined
Jan 18, 2004
Messages
507
Location
Longview, TX [USA]
After my ASP.NET page has successfully sent an email, I change my Lable to read:
Visual Basic:
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.
 
HJB417 said:
or a meta refresh
Never 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?
 
eramgarden said:
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!
 
eramgarden said:
well, you just said you implemented it for another page..how did you do it? cant you use the same code??
What I want is something that works within my Button_Click() subroutine:
Visual Basic:
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:
Visual Basic:
Mail.Send
Response.Redirect("OK.htm")
where the code in the OK.htm page is:
Code:
<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.
 
Back
Top