Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4.5 > BOOK: Professional ASP.NET 4.5 : in C# and VB
Password Reminder
Register
Register | FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
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: 100%
Activity: 100% Activity: 100% Activity: 100%
 
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>
Reply With Quote
  #2 (permalink)  
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: 100%
Activity: 100% Activity: 100% Activity: 100%
 
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!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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 03: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 02:38 PM
Ch.10 p.341, TIO.5 contact.aspx Gerrie BOOK: Beginning ASP.NET 4 : in C# and VB 2 January 25th, 2013 02: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 03:12 AM
Ch. 5 - Contact Picker - Data Source not found eCubeH BOOK: Professional Android 2 Application Development 0 May 6th, 2010 02:53 AM



All times are GMT -4. The time now is 05:18 AM.


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