views:

73

answers:

3

I want to change the cursor to an hourglass in my asp.net application to let my users know that the process is running. I searched for an answer and was advised to use javascript as follows.

1) Add this javascript

function hourglass() {

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

2) then in my code in the page load event:

btnImport.Attributes.Add("onclick", "javascript: hourglass();");

When btnImport is the button they click on

However this does not work. But if I add an alert to the hourglass function. it does work. Is there some way to get this to work without the alert.

Thanks in advance.

Bob Avallone

A: 

Have you tried the code in the codeproject article.

http://www.codeproject.com/KB/scripting/doHourglass.aspx

ggonsalv
A: 

How about this:

btnImport.Attributes.Add("onclick", "hourglass();");
azamsharp
+1  A: 

Is it an Ajax-Webapp? Then you could use an UpdateProgress Control to show while the user is waiting till import finished.

Tim Schmelter
Tim,This is what I needed. It works great.Thanks to everyone who responded.Bob
Bob Avallone