Click here to Skip to main content
15,886,788 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In my asp.net application I want to disable all server side buttons when server is processing a request. How to do it?
Thanks in advance
Posted
Updated 11-Feb-11 22:36pm
v2
Comments
JF2015 12-Feb-11 4:36am    
Removed pre tags and improved spelling.

1 solution

One of the ways to do it could be using Javascript.

Whenever any control triggers a server processing, at that event before sending the request to server, use Javascript and disable all the server buttons.
Once processing is complete you can enable them again.

Using jQuery would be more simplerer for such scenario. Try!
 
Share this answer
 
Comments
Albin Abel 12-Feb-11 5:10am    
my 5
Rounak Hasan 12-Feb-11 5:57am    
But how could I know that the processing is completed.
Sandeep Mewara 12-Feb-11 6:35am    
If you are having full postback for server processing then once the operation is complete (lets say fetching of data from DB), after that, enable all the buttons back from server side. Page will re-render and all good.

If, you must be having some AJAX postback or XMLHttpReuqest kind of thing, then once the response is recieved back from server, you can re-enable the buttons.

For AJAX, you can trap event as described here: http://www.codeproject.com/KB/ajax/AfterAjaxUpdate.aspx
For XMLHttpRust or similar: you already have a method where you get back a response and you act accordingly.
Rounak Hasan 15-Feb-11 13:59pm    
Thanks...I have written a javascript function to disable all contrls and attached it with onclick event of every buttons...But when page is not postback due to some validation then also all controls are getting disabled.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900