Last post Aug 05, 2013 08:56 PM by AceCorban
Sep 12, 2007 08:58 PM|new2aspdotnet|LINK
the alert never shows up. I tried changing the endReponse to true and false, it did not work. Any suggestions?
Sep 12, 2007 09:43 PM|A1ien51|LINK
You need to do the redirect from the client
Sep 18, 2007 09:02 AM|Benson Yu - MSFT|LINK
Based on my understanding, you have a page for sending mail. If sending the mail successfully, you want to redirect to the home page and then popup a message box to tell client that the mail has been sent successfully. The concern is how to popup the message
box after redirect. If I have misunderstood your concern, please let me know.
For this scenario, we can add a function in the home page to verify if we need to show the message. If the mail has been sent successfully, redirect to the home page with a parameter, for example: redirect to “home.aspx?Mail=true”. Then in the home
page onload event handler, check the parameter and estimate if we need popup the message.
For your reference, please refer to the following code. I hope it is helpful to you.
<html xmlns="http://www.w3.org/1999/xhtml" >
var queryString = document.location.search.replace('?','');
var parameters = queryString.split('&');
for (i=0; i<parameters.length; i++)
if (parameters[i].substring(0,5) == 'Mail=')
if(parameters[i].replace('Mail=','') == 'true')
alert('mail has been sent successfully');
<form id="form1" runat="server">
this is the home page
Sep 18, 2007 09:14 AM|kipo|LINK
Try with this code:
Sep 18, 2007 09:17 AM|windows_mss|LINK
Try This If You Are Using Ajax Enabled Site
Change The Index.aspx to any aspx page according to your need
May 25, 2013 08:50 AM|anubhavharlalka|LINK
Try with this code:
This one worked perfecto! Thanks kipo!
Aug 05, 2013 10:20 AM|EhsaE|LINK
It may use in Same Page
Aug 05, 2013 08:56 PM|AceCorban|LINK
There are probably cleaner ways to handle this functionality (like registering a script to the script manager over setting the text of a label), but this will work as you are intending.
Just for your own edification, here's what I'm talking about:
Page.RegisterStartupScript(this.GetType(), "SuccessMessageScript", "alert(\"Your email has been sent successfully!\"); location.href=\"Home.aspx\";", true);
This would take place of your code and you wouldn't need the label at all.