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:
-
Add this JavaScript:
function hourglass() { document.body.style.cursor = "wait"; } -
then in my code in the page load event:
btnImport.Attributes.Add("onclick", "javascript: hourglass();");
Where btnImport is the button they click on.
However this does not work. If I add an alert to the hourglass function. it does work. Is there some way to get this to work without the alert?
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
How about this:
btnImport.Attributes.Add("onclick", "hourglass();");
Method 2
Is it an Ajax-Webapp? Then you could use an UpdateProgress Control to show while the user is waiting till import finished.
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0