- Add a <div> tag to your HTML code that will be used for hosting the "Processing..." message or image. Here is a simple example:
<div align="center" id="div_ProcessingMessage" runat="server" style="display: none;"><span> Processing... </span></div>
- Add a javascript function that displays the above-mentioned <div> when called (NOTE: you could also add code to disable controls that you don't want the user touching in the event of a long running process). Here is a simple example:
<script type="text/javascript"> function EnableProcessingMessage() { var test = document.getElementById('div_ProcessingMessage'); test.style.display = ""; }
- Add an "onsubmit" attribute to the <form> tag of your web page that calls the above-mentioned javascript function. Here is a simple example:
<form id="form1" runat="server" onsubmit="EnableProcessingMessage()">
By the way, if you don't want the users clicking on various controls during a long running operation, you can prevent them from doing so by adding code to your javascript method that can temporarily hide or disable those controls.
Now, if you're using AJAX, this strategy won't work so I'll provide you with another solution for that in my next post...
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.