I am trying to validate two checkbox lists in my usercontrole.after some googling i am able to validate my first checkbox list.code is given below
<script language="javascript" type="text/javascript">
function ValidateChkList(source, arguments) {
arguments.IsValid = IsCheckBoxChecked() ? true : false;
}
function IsCheckBoxChecked() {
var isChecked = false;
var list = document.getElementById('<%= cblJobType.ClientID %>');
if (list != null) {
for (var i = 0; i < list.rows.length; i++) {
for (var j = 0; j < list.rows[i].cells.length; j++) {
var listControl = list.rows[i].cells[j].childNodes[0];
if (listControl.checked) {
isChecked = true;
}
}
}
}
return isChecked;
}
<asp:CustomValidator ID="cvJobType" ClientValidationFunction="ValidateChkList" CssClass="error"
SetFocusOnError="True" ValidationGroup="step1" runat="server"></asp:CustomValidator>
but when i try the same on second one both are not working.can any one help me..
Try with: