Enable Disable CheckBoxList based on another using jQuery in ASP.Net

Last Reply 11 months ago By dharmendr

Posted 11 months ago


i have 2 checkbox list, i want javascript to hide CHECKBOXLIST 2 conditinally so if in checkbox list one Value "TWO" is checked so CHEKXBOXLIST 2 Visible true else visible false

Posted 11 months ago

Hi nauna,

Check this example. Now please take its reference and correct your code.


<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript">
    $(function () {
        $("[id*=CheckBoxList1]").bind("click", function () {
            if ($("[id*=CheckBoxList1] input:checked").length > 0) {
                $.each($("[id*=CheckBoxList1] input:checked"), function () {
                    if ($(this).val() == 'Two') {
<asp:CheckBoxList ID="CheckBoxList1" runat="server">
    <asp:ListItem Text="One" Value="One" />
    <asp:ListItem Text="Two" Value="Two" />
<br />
<asp:CheckBoxList ID="CheckBoxList2" runat="server" Style="display: none">
    <asp:ListItem Text="Mango" Value="Mango" />
    <asp:ListItem Text="Apple" Value="Apple" />