ASP.NET - Display Message While Page Is Loading

Posted by Chris on Stack Overflow See other posts from Stack Overflow or by Chris
Published on 2010-06-10T18:05:10Z Indexed on 2010/06/10 18:12 UTC
Read the original article Hit count: 321

Filed under:
|
|

I have a page that performs a long-running task (10 to 15 seconds) in the page_load method.

I have client-side javascript code that will display a decent "page loading" animated gif to the user.

I am able to invoke the JavaScript method from the code-behind, to display the "page loading" animated gif, however, the long-running task is hanging up the UI such that the animated gif doesn't actually display until after the long-running task is complete, which is the exact opposite of what I want.

To test this out, in my page_load method I make a call to the JavaScript method to display the animated gif. Then, I use Thread.Sleep(10000). What happens is that the animated gif doesn't display until after Thread.Sleep is complete.

Obviously I am doing something incorrect.

Any advice would be appreciated.

Thanks.

Chris

© Stack Overflow or respective owner

Related posts about c#

Related posts about ASP.NET