Disable gridview controls using jquery in aspx form
<p>I have a form in which there is a CheckBox and a gridview. When I uncheck the CheckBox I want controls in my Gridview to be disabled. here is my gridview aspx:</p>

<pre><code>                            &lt;div id="gridVersion" runat="server"&gt;
                                &lt;ac:GridViewWithPager ID="gdvwAllowedVersion" runat="server" UseCustomPager="True"
                                    AllowPaging="True" AutoGenerateColumns="False" Width="50%"&gt;
                                    &lt;Columns&gt;
                                        &lt;asp:TemplateField ItemStyle-CssClass="centerdata"&gt;
                                            &lt;ItemTemplate&gt;
                                                &lt;asp:RadioButton ID="rdblSelectedVersionList" runat="server" AutoPostBack="true" Checked='&lt;%#Eval("IsSelected") %&gt;'
                                                    EnableViewState="true" OnCheckedChanged="rdblSelectedVersionList_CheckedChanged" /&gt;
                                            &lt;/ItemTemplate&gt;
                                            &lt;HeaderStyle HorizontalAlign="Center" Width="2%"&gt;&lt;/HeaderStyle&gt;
                                        &lt;/asp:TemplateField&gt;
                                        &lt;asp:TemplateField HeaderText="IDEAlliance Version" HeaderStyle-Width="11%" HeaderStyle-HorizontalAlign="Left"&gt;
                                            &lt;ItemTemplate&gt;
                                                &lt;asp:Label ID="lblVersion" runat="server" Text='&lt;%# Eval("IdeAllianceVersion") %&gt;' /&gt;
                                            &lt;/ItemTemplate&gt;
                                            &lt;HeaderStyle HorizontalAlign="Left" Width="11%"&gt;&lt;/HeaderStyle&gt;
                                        &lt;/asp:TemplateField&gt;
                                        &lt;asp:TemplateField HeaderText="Restrict Import Of" ItemStyle-CssClass="centerdata"
                                            HeaderStyle-Width="2%" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="2%"&gt;
                                            &lt;ItemTemplate&gt;
                                                &lt;asp:CheckBox ID="chkCheckRestrictImport" runat="server" Checked='&lt;%# Eval("RestrictedForImport")%&gt;' /&gt;
                                            &lt;/ItemTemplate&gt;
                                            &lt;HeaderStyle HorizontalAlign="Center" Width="2%"&gt;&lt;/HeaderStyle&gt;
                                            &lt;ItemStyle HorizontalAlign="Center" Width="2%"&gt;&lt;/ItemStyle&gt;
                                        &lt;/asp:TemplateField&gt;
                                        &lt;asp:TemplateField HeaderText="Restrict Upgrade To" ItemStyle-CssClass="centerdata"
                                            HeaderStyle-Width="2%" ItemStyle-HorizontalAlign="Left" ItemStyle-Width="2%"&gt;
                                            &lt;ItemTemplate&gt;
                                                &lt;asp:CheckBox ID="chkCheckRestrictUpgrade" runat="server" Checked='&lt;%# Eval("RestrictedForUpgrade")%&gt;' /&gt;
                                            &lt;/ItemTemplate&gt;
                                            &lt;HeaderStyle HorizontalAlign="Center" Width="2%"&gt;&lt;/HeaderStyle&gt;
                                            &lt;ItemStyle HorizontalAlign="Center" Width="2%"&gt;&lt;/ItemStyle&gt;
                                        &lt;/asp:TemplateField&gt;
                                    &lt;/Columns&gt;
                                &lt;/ac:GridViewWithPager&gt;
                            &lt;/div&gt;
</code></pre>

<p>My CheckBox control is something like this:</p>

<pre><code>&lt;asp:CheckBox ID="chkActivateSettings" runat="server" Text="Activate Restriction Settings."&gt;
                                    &lt;/asp:CheckBox&gt;
</code></pre>

<p>I have already written a Jquery code that hides and shows this grid. But now what I want is to disable control in this grid upon unchecking the CheckBox. So I want to modify this code:</p>

<pre><code>$(document).ready(function () {

    if ($('#&lt;%=chkActivateSettings.ClientID %&gt;').is(":checked")) {
        //show the hidden div
        $('#&lt;%=gridVersion.ClientID %&gt;').show("fast");
    }
    else {
        //otherwise, hide it
        $('#&lt;%=gridVersion.ClientID %&gt;').hide("fast");
    }
    // Add onclick handler to checkbox w/id checkme
    $('#&lt;%=chkActivateSettings.ClientID %&gt;').click(function () {

        // If checked
        if ($('#&lt;%=chkActivateSettings.ClientID %&gt;').is(":checked")) {
            //show the hidden div
            $('#&lt;%=gridVersion.ClientID %&gt;').Ena("fast");
        }
        else {
            //otherwise, hide it
            $('#&lt;%=gridVersion.ClientID %&gt;').hide("fast");
        }
    });

});
</code></pre>

<p>Looking forward to your usual cooperation.</p>
