mardi 1 août 2017

having a System.ArgumentException when executing query

i'm currently working on a project and i have this problem. i have a checkBox that when checked it should check all other options and when unchecked it does the same for others so i wrote this code:

<label><asp:checkBox type="checkbox" ID="all" value="" OnCheckedChanged="checkAll();" runat="server" />All</label>

the javascript is as below:

     function checkAll() {
        var op = document.getElementById('CheckBoxList1');
        if (box.checked) {
            for (var i = 0; i < op.childNodes.length; i++) {
                op.childNodes[i].checked == true;
            }
        }

        else {
            for (var i = 0; i < op.childNodes.length; i++) {
                op.childNodes[i].checked == false;
            }
        }
    }

how ever i got these errors: ") expected" and "invalid expression term')'"
i don't know what i'm doing wrong and i've tried almost everything here is my checkBoxList code if it would help:

                     <asp:CheckBoxList ID="CheckBoxList1" runat="server" DataSourceID="SqlDataSource1" DataTextField="ipAddress" DataValueField="ipAddress" CellSpacing="-1">
                 </asp:CheckBoxList>
                 <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="SELECT [ipAddress] FROM [Clients]"></asp:SqlDataSource>




Aucun commentaire:

Enregistrer un commentaire