Tuesday, July 7, 2009

Simple ‘In-Progress’ Message for time taking tasks in ASP.Net Pages


We often come across web pages which take more time to perform a task when the user clicks a Button control. Users often tend to click the other options of the page during the delay – which causes unexpected behavior and strange results of the page. It is always sensible to display an ‘In-Progress’ message when your web page is taking more than a few seconds to perform the server side task. There are other complex ways of doing the same using Ajax.Net control like ‘Modal Popup Extender’, Modal window, iframe... etc.

My solution is a simple JavaScript which is fast, light weight & also don’t have to disturb your ASP.Net server side code. This should also work fine for other web programming languages like PHP, JSP, Cold Fusion... etc.


I have a ASPX page, which retrieves data and binds to a ASP.Net Grid on a Button click. This process takes 30 seconds to display the results, during which the page has to:
1.Display a ‘In-Progress’ message (with a Gif image for animated feel)
2.Restrict the user from accessing other controls during the ‘in-Process’ message is displayed.
To avoid unwanted post backs.

Process Message Display


1.Add a Div tag to the html code, to display the message and image. Set the visibility of the div tag as hidden.

See full detail: http://www.codeproject.com/KB/aspnet/In-Progress_Message.aspx

No comments: