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!!
|