Abhijit Abhijit - 1 year ago 104
ASP.NET (C#) Question

Check atleast one checkboxlist item is selected in javascript

I want to check if atleast one item in asp:checkbox list is selected or not and if atleast one item is selected in checkboxlist then I want to enable button.

Please help!!!

Answer Source

Refer the link Validating checkboxList Asp.Net control using javascript for details. Please try:

<script language="javascript" type="text/javascript"> 
function CheckItem(sender, args){     
    var chkControlId = '<%=chkMealPeriod.ClientID%> '    
    var options = document.getElementById(chkControlId).getElementsByTagName('input');    
    var ischecked=false;    
    args.IsValid =false;    
        var opt = options[i];        
                ischecked= true;                
                args.IsValid = true;                            
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download