I have an Intranet ASP.NET application which is sometimes slow to respond. My requirement is to prevent double submit, and ideally provide feedback to the user that the form has already been submitted.
Examples I've found show how to disable a submit button, but that's not enough, as in my app the submit can happen:
- From a submit button.
- From any control with AutoPostBack = true (which submits using javascript AFAIK).
- From either of the above within an UpdatePanel - in which case as I understand it, the POST is done using AJAX, and I would need to re-enable when the AJAX call is complete.
I'm thinking of something like displaying an overlay / modal popup, perhaps with an animated progress image which would be displayed while submitting. And in the case of an UpdatePanel, hidden when the AJAX call completes.
Does anyone have a sample that can be easily integrated into ASP.NET pages as above? Or indicate what events I would need to hook into to display / hide the overlay.
UPDATE
@Aristos' answer has got me most of the way there. The key part is to handle PageRequestManager.endRequest to hide the progress dialog when an AJAX call is complete.
There is one case where I still have a problem: if a submit button results in a file download, I don't have an event I can use to hide my progress dialog. This question has an answer which may do the trick, I'll try it out.