aspdotnet-suresh offers articles and tutorials,csharp dot net, articles and tutorials,VB.NET Articles,Gridview articles,code examples of 2.0 /3.5,AJAX,SQL Server Articles,examples of .net technologies

JQuery how to disable/enable all the controls on page

Jul 23, 2012

Here I will explain how to disable or enable all the controls in page using JQuery in

In previous articles I explained Bind gridview using JQuery in  and AutoComplete textbox with JQuery using and many articles relating to JQuery. Now I will explain how to disable or enable all the controls in webpage using JQuery in

To implement this one we need to write code as shown below in your aspx page

<html xmlns="">
<title>Disable or Enable All Controls on a Page</title>
<script type="text/javascript" src="">
<script type="text/javascript">
$(document).ready(function() {
$("#btnEnableDisable").toggle(function() {
$("*").attr("disabled", "disabled");
$(this).attr("disabled", "");
}, function() {
$("*").attr("disabled", "");
<form id="form1" runat="server">
First name: <asp:TextBox ID="txtfname" runat="server"/><br />
Last name: <asp:TextBox ID="txtlname" runat="server"/><br />
Password: <asp:TextBox ID="txtpwd" runat="server"/><br/>
<asp:RadioButtonList ID="rdbtn" runat="server">
<asp:ListItem Value="male" Text="Male"/>
<asp:ListItem Value="female" Text="Female"/>
<asp:CheckBoxList ID="chkVehicle" runat="server">
<asp:ListItem Value="Bike" Text="I have a bike"/>
<asp:ListItem Value="Car" Text="I have a car"/>
<asp:DropDownList ID="ddlBuses" runat="server">
<asp:ListItem Value="volvo" Text="Volvo" />
<asp:ListItem Value="saab" Text="Saab"/>
<asp:ListItem Value="Audi" Text="Audi"/>
<asp:ListItem Value="ford" Text="Ford"/>
<textarea rows="5" cols="40" > </textarea>
<asp:Button ID="btnEnableDisable" runat="server" Text="Enable/Disable" />
If you observe above code in header section I added script file link by using that file we have a chance to interact with JQuery and in the script we have btnEnableDisable button toggle function it will disable all the controls on the page including button control also because of that we need to write code to disable only particular controls instead of disable all the controls. For that check this link how to disableparticular controls on page using jquery in


If you enjoyed this post, please support the blog below. It's FREE!

Get the latest,, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email.

subscribe by rss Subscribe by RSS subscribe by email Subscribe by Email


Jitendra said...

Nice Article.......keep it up ...Sir..

Unknown said...

Sir, I want to know that how all the controls on the page remains inactive until the complete page gets loaded.
Any control should be activated only after the complete page is loaded just like icici bank website functions.

Give your Valuable Comments

Note: Only a member of this blog may post a comment.

© 2015 All Rights Reserved.
The content is copyrighted to Suresh Dasari and may not be reproduced on other websites without permission from the owner.