Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4 > BOOK: Beginning ASP.NET 4 : in C# and VB
|
BOOK: Beginning ASP.NET 4 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4 : 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 December 21st, 2011, 10:30 PM
Authorized User
 
Join Date: Dec 2011
Posts: 26
Thanks: 1
Thanked 4 Times in 3 Posts
Default SlideUp in Animating Contact Form exercise requires System.threading...Sleep?

Hello,
I have worked through the exercise on Animating the Contact Form (pg. 339). I have noticed one thing: The Sleep in the code behind affects the slideUp.
I thought the Please Wait message with the spinning .gif was silly at that point; so, I commented it out.
// System.Threading.Thread.Sleep(5000);
This is in the ControlForm.ascx.cs file. (The code behind for ControlForm.)

When I comment that line out, not making any other changes, the jQuery slideUp happens really fast or isn't even happening.
(I've gotten slightly mixed results with my testing and my browser cache seems it might be affecting it. So, I am not solid on the behavior yet. If I clear the browser, then I never see the slide up happen. Other times it just seems to happen very fast.)
If I uncomment it (so it is "active" if you will), then it works just fine. So, my question is: Why is this? Shouldn't that slideUp(3000) take 3 seconds regardless of the Thread.Sleep command?
 
Old December 23rd, 2011, 04:12 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

When you click the Submit button, the form is submitted to the server. While the server is processing your request, the animation plays. However, as soon as the page is done at the server, the result of it is streamed back to the browser, whiping out whatever was there (including the playing animation). The Sleep method keeps the server busy so you can see the animation play; this is only meant as a simulation of a slow server response and shouldn't be used in a real-world application.

Hope this helps,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Perception System Requires Flex Developers - Ahmedabad kethywright BOOK: ASP.NET Website Programming Problem-Design-Solution 0 January 21st, 2009 07:15 AM
Perception System Requires iPhone Developer perceptwilli Forum and Wrox.com Feedback 0 January 17th, 2009 06:38 AM
System.Threading timer problem for beginner (Windo erikmail C# 2005 1 June 8th, 2006 08:03 AM
Understanding System.Threading.ReaderWriterLock AgentSmith General .NET 1 September 8th, 2005 02:38 PM





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