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 > BOOK: Beginning ASP.NET 4 : in C# and VB
Password Reminder
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 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
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 21st, 2011, 10:30 PM
Authorized User
Points: 148, Level: 2
Points: 148, Level: 2 Points: 148, Level: 2 Points: 148, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
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?

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?
Reply With Quote
  #2 (permalink)  
Old December 23rd, 2011, 04:12 AM
Imar's Avatar
Wrox Author
Points: 72,045, Level: 100
Points: 72,045, Level: 100 Points: 72,045, Level: 100 Points: 72,045, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,083
Thanks: 80
Thanked 1,587 Times in 1,563 Posts

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 Spaanjaars
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!
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

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

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

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