p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/)
-   BOOK: Professional ASP.NET 4.5 : in C# and VB (http://p2p.wrox.com/book-professional-asp-net-4-5-c-vb-736/)
-   -   Ch 11 Animating the Contact Form (http://p2p.wrox.com/book-professional-asp-net-4-5-c-vb/99576-ch-11-animating-contact-form.html)

JackBlack99 July 17th, 2017 07:25 AM

Ch 11 Animating the Contact Form

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:


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);

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();

lblMessage.Visible = true;
MessageSentPara.Visible = true;
FormTable.Visible = false;
catch (SmtpException)
lblMessage.Text = "An error occurred while sending your e-mail. Please try again.";
lblMessage.Visible = true;



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

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

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



/// <reference path="jquery-3.1.1.js" />

JackBlack99 July 18th, 2017 11:06 AM

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

All times are GMT -4. The time now is 06:21 PM.

Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
2013 John Wiley & Sons, Inc.