- <asp:CheckBoxList ID="chkList" runat="server">
- <asp:ListItem>Item Oneasp:ListItem>
- <asp:ListItem>Item twoasp:ListItem>
- <asp:ListItem>Item threeasp:ListItem>
- <asp:ListItem>Item fourasp:ListItem>
- asp:CheckBoxList>
- <asp:Button ID="btnSubmit" runat="server" ValidationGroup="CHK" OnClientClick="return validateChk();" Text="Validate"/>
JAVASCRIPT CODE:
- function validateChk() {
- debugger;
- var found = false;
- var validated = false;
- var id = document.getElementById("").id;
- var elements = document.forms[0].elements;
- for (i = 0; i <>
- if (elements[i].type == "checkbox" && elements[i].id.indexOf(id) > -1) {
- found = true;
- if (elements[i].checked) {
- validated = true;
- break;
- }
- }
- }
- if (found && validated)
- return true;
- else
- return false;
- }
No comments:
Post a Comment