Last post Mar 01, 2012 04:56 PM by thelongislander
Mar 01, 2012 04:30 PM|thelongislander|LINK
i have created a contact me form . i have two questions
1. when the user hits submit how do i ge the page to refresh without displaying the data they had entered . "also i may add in the last line of code it shows the user the email was sent" would this still display if i rerech the page withought the data....
2. with the code i have how do i send a reply to the user saying thank you your request has been sent someone willl respond shortly....... something on those lines...
thanks in advance for your help.
Mar 01, 2012 04:35 PM|DarthSwian|LINK
clearing the form is a simple mater of doing
txtUserName.text = string.empty;
in your processing function for all fields to clear.
You can have a function to send the email and have it retrun a boolean value with pass fail to determine to show a success message.
Take a look at this for sending email
Mar 01, 2012 04:39 PM|ramiramilu|LINK
this is what you want - http://www.intstrings.com/ramivemula/asp-net/ajax-html-editor-based-contact-form-inside-updatepanel-along-with-updateprogress/
Mar 01, 2012 04:40 PM|Wozer|LINK
for #1 you on your button click, after the submission if finished just set all textbox values equal to "" That will make them all blank, then after all that happens show a div that has "Email Sent" that is initially hidden with divname.style("display") =
"block" or do label.Text = "Email Sent" if you want to use a blank label.
#2 You can send an email in code behind with this (VB.NET)
'Send Email confirming Receipt.
Dim objMM As New MailMessage()
'Set the properties - send the email to the person who filled out the feedback form.
objMM.From = New MailAddress("email@example.com")
'Send the email in text format
objMM.IsBodyHtml = True
'Set the subject
objMM.Subject = "Email Subject"
'Set the body
objMM.Body = "Thank you for submitting. This email is to confirm that everything has been received"
objMM.Priority = MailPriority.Normal
'Specify to use the default Smtp Server
Dim mSmtpClient As New SmtpClient
mSmtpClient.Host = "someip"
Mar 01, 2012 04:51 PM|thelongislander|LINK
TY Very much!!!! can you send that code in c#?
Mar 01, 2012 04:53 PM|Wozer|LINK
I dont have it in C# but using a converter it came up with this (May not be 100% accurate)
MailMessage objMM = new MailMessage();
//Set the properties - send the email to the person who filled out the feedback form.
objMM.From = new MailAddress("firstname.lastname@example.org");
//Send the email in text format
objMM.IsBodyHtml = true;
//Set the subject
objMM.Subject = "Email Subject";
//Set the body
objMM.Body = "Thank you for submitting. This email is to confirm that everything has been received";
objMM.Priority = MailPriority.Normal;
//Specify to use the default Smtp Server
SmtpClient mSmtpClient = new SmtpClient();
mSmtpClient.Host = "someip";
Mar 01, 2012 04:56 PM|thelongislander|LINK
ty all this is all very helpful