Simple loading message to entertain user during background processes

There are a lot of ways this can be done, including using Ajax, Telerik controls or Update Panels, but with ASP.Net and Javascript, it can be very simple.  All you need is a server-side label, a simple css class and some simple jQuery.  First, your label with the loading text:

The css class is simple enough.  It just hides the label when we don’t want to see it.

Now, we can run some simple jQuery when the event occurs where we want to show the loading label (in this case,  a button click) to remove the css class from the element that is causing it to be hidden:

All we have to do now is hide the loading label by adding the appropriate css class after our work is finished on the server-side:

Easy, right?  I love easy!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s