Problem solve Get help with specific problems with your technologies, process and projects.

Displaying an hourglass icon in an ASP.NET Web Form

Is there a 'waiting' hourglass method to display an hourglass icon for an ASP.NET Web Form (code behind = VB) like the hourglass used in Visual Basic 6.0?
First you need to understand that ANYTHING you execute in the code behind is NOT going to reflect on the client browser inmediately (there are exceptions, but are more advanced). The Web Form is not "live" as VB6 ones. Until the HTML code is sent to the client again, the browser will just remain waiting for it. But if you're actually executing the server-side code through JavaScript (I mean through the XmlHttpRequest object), you can put an hourglass in the browser by changing the body style with the following code:

document.body.style.cursor = "wait";

Note, however, that it's useless if you're performing a postback (a form submit) to the server, as the whole page will dissapear from the browser.

Dig Deeper on Win Development Resources

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.