<tr>
                        <td height="12" align="left" class="cont">
                            <asp:CheckBox ID="chkacsoutreach" runat="server" />Acs Outreach                        </td>
                    </tr>
                    <tr>
                        <td height="12" align="left" class="cont">
                           <asp:CheckBox ID="chkaceportal" runat="server" /> Ace Portal                        </td>
                    </tr>

I took some checkboxes in the following way.I should get a message if atleast 1 checkbox is not checked and the values should not be entered into the database.This is the validation i needed.I have written the javascript code as below:but instead of 'controls[]' there should be a groupname which combines all the checkboxes.Iam not understanding what name to give here.Can any one please help me out

<script type="text/javascript" language="javascript">
                      function validate() {                          var chks = document.getElementsByName('controls[]');                          var hasChecked = false;                          for (var i = 0; i < chks.length; i++) {                              if (chks[i].checked) {                                  hasChecked = true;                                  break;                              }                          }                          if (hasChecked == false) {                              alert("Please select at least one.");                              return false;                          }                          return true;                      }                          </script>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.