Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
BOOK: Professional ASP.NET 4.5 : in C# and VB
This is the forum to discuss the Wrox book Professional ASP.NET 4.5 in C# and VB by Jason N. Gaylord, Christian Wenz, Pranav Rastogi, Todd Miranda, Scott Hanselman; ISBN: 978-1-1183-1182-0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional ASP.NET 4.5 : in C# and VB section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 17th, 2017, 07:25 AM
Registered User
Points: 42, Level: 1
Points: 42, Level: 1 Points: 42, Level: 1 Points: 42, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2017
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default Ch 11 Animating the Contact Form

Hi,

I have copied the code for this Try It Out section but I do not see any animation after the message has been sent. As I am unable to see where the problem is in my code I was hoping that someone could help?

My code files are as follows:

ContactForm.ascx.cs

<code>
...
protected void btnSend_Click(object sender, EventArgs e)
{
if (Page.IsValid)
{
string fileName = Server.MapPath("~/App_Data/ContactForm.txt");
string mailBody = System.IO.File.ReadAllText(fileName);

mailBody = mailBody.Replace("##Name##", txtName.Text);
mailBody = mailBody.Replace("##Email##", txtEmailAddress.Text);
mailBody = mailBody.Replace("##HomePhone##", txtPhoneHome.Text);
mailBody = mailBody.Replace("##BusinessPhone##", txtBusinessPhone.Text);
mailBody = mailBody.Replace("##Comments##", txtComments.Text);

try
{
MailMessage myMessage = new MailMessage();
myMessage.Subject = "Response from web site";
myMessage.Body = mailBody;

myMessage.From = new MailAddress(AppConfiguration.FromAddress, AppConfiguration.FromName);
myMessage.To.Add(new MailAddress(AppConfiguration.ToAddress, AppConfiguration.ToName));

SmtpClient mySmtpClient = new SmtpClient();
mySmtpClient.Send(myMessage);

lblMessage.Visible = true;
MessageSentPara.Visible = true;
FormTable.Visible = false;
//System.Threading.Thread.Sleep(5000);
}
catch (SmtpException)
{
lblMessage.Text = "An error occurred while sending your e-mail. Please try again.";
}
finally
{
lblMessage.Visible = true;
}
}
}

</code>

ContactForm.asx:

<code>
<asp:UpdatePanel ID="UpdatePanel1" runat="server"><ContentTemplate>
<div id="TableWrapper">
<table class="auto-style1" runat="server" id="FormTable">
...
</table>
</div>

<asp:Label ID="lblMessage" runat="server" Text="Message Sent" Visible="false"></asp:Label>
<p runat="server" id="MessageSentPara" visible="False">Thank you for your message.
We'll get in touch with you if necessary.</p></ContentTemplate>
</asp:UpdatePanel>
...


</asp:UpdateProgress>
<script type="text/javascript">
$(function () {
$('form').bind('submit', function () {
if (Page_IsValid) {
$('#TableWrapper').slideUp(3000);
}
});
});
function pageLoad()
{
$('.Attention').animate({ width: '600px' }, 3000)
.animate({ width: '100px' }, 3000)
.fadeOut('slow');
}
</script>

</code>

_reference.js:

<code>
/// <reference path="jquery-3.1.1.js" />
</code>
 
Old July 18th, 2017, 11:06 AM
Registered User
Points: 42, Level: 1
Points: 42, Level: 1 Points: 42, Level: 1 Points: 42, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2017
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I found the problem. I had not included the CssClass attribute in the label control. It is working now!




Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 11: Contact Us page, HTML Error 404.0 MeTP BOOK: Beginning ASP.NET 4.5.1 : in C# and VB 1 December 30th, 2014 04:40 PM
Ch 11 jQuery animating the Contact Form Try it Out AlanWheeler BOOK: Beginning ASP.NET 4.5 : in C# and VB 1 January 28th, 2014 03:38 PM
Ch.10 p.341, TIO.5 contact.aspx Gerrie BOOK: Beginning ASP.NET 4 : in C# and VB 2 January 25th, 2013 03:50 PM
SlideUp in Animating Contact Form exercise requires System.threading...Sleep? Notso BOOK: Beginning ASP.NET 4 : in C# and VB 1 December 23rd, 2011 04:12 AM
Ch. 5 - Contact Picker - Data Source not found eCubeH BOOK: Professional Android 2 Application Development 0 May 6th, 2010 02:53 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.