CODEDIGEST
Home » CodeDigest
Search
 

Technologies
 

How to Disable the page or All Page control using jQuery in ASP.Net?
Submitted By Satheesh Babu B
On 7/27/2010 8:46:36 AM
Tags: ASP.Net,CodeDigest,jQuery  

How to disable the page or All Page control using jQuery in ASP.Net?

 

The introduction of jQuery has made every client side operations a lot easier.  This little jquery snippet will help you to disable the whole page controls at a stretch.
 
It is very easy to access all the page controls using the jQuery selector expression. The selector expression "*" will return an array of all the controls in the page. Now, to disable the control we can set the disabled btml atrribute to disabled.


On clicking the button with id #btnDisable, the below jquery script will select all the page controls and will set the disabled attribute.
 
<script src="_scripts/jquery-1.4.1.min.js" type="text/javascript"></script>

       <script language="javascript">

           $(document).ready(function() {

               $("#btnDisable").click(function() {
                    $("*").attr("disabled", "disabled");            
               });

   });
    </script>

On executing the above code, the page controls will be disabled and cannnot be used.

Happy Coding!!

Do you have a working code that can be used by anyone? Submit it here. It may help someone in the community!!

Recent Codes
  • View All Codes..