Link to home
Start Free TrialLog in
Avatar of solution1368
solution1368

asked on

asp.net checkbox

I have jquery function working with the radio button as follow, and I want to add it as checkbox. How can make the asp panel show/hide by using checkbox instead of radio button list?

Thanks

<asp:CheckBox runat="server" ID="ProductionEquipmentCreateAnotherperiodTime" Text="Check if you want to create another period time" /></td>


<asp:RadioButtonList RepeatLayout="Flow" runat="server" RepeatDirection="Horizontal" ID="ProductionEquipmentCoverage">
<asp:ListItem Value="Yes" Text="Yes"></asp:ListItem><asp:ListItem Value="No" Text="No"></asp:ListItem>
</asp:RadioButtonList>
<script type="text/javascript">
    $("#<%=ProductionEquipmentCoverage.ClientID%>").change(function () {
        var rbvalue = $("input[name='<%=ProductionEquipmentCoverage.UniqueID%>']:radio:checked").val();
        if (rbvalue == "Yes") {
            $('#<%= PanelProductionEquipmentItems.ClientID %>').show('slow');
        }
        else if (rbvalue == "No") {
            $('#<%= PanelProductionEquipmentItems.ClientID %>').hide('slow');
        }

    });
</script>

<asp:Panel runat="server" ID="PanelProductionEquipmentItems" />
Avatar of leakim971
leakim971
Flag of Guadeloupe image

<script type="text/javascript">
    $("#<%=ProductionEquipmentCoverage.ClientID%>").change(function () {
        var rbvalue = $(this).is(":checked");
        if (rbvalue) {
            $('#<%= PanelProductionEquipmentItems.ClientID %>').show('slow');
        }
        else if (rbvalue == "No") {
            $('#<%= PanelProductionEquipmentItems.ClientID %>').hide('slow');
        }

    });
</script>

Open in new window

Avatar of solution1368
solution1368

ASKER

there is no value in inside of the asp.net checkbox control.
how will it works in the if else statement?
ASKER CERTIFIED SOLUTION
Avatar of leakim971
leakim971
Flag of Guadeloupe image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial