Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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.

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

Posted
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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...