The below code snippet explains how to check or uncheck all checkboxes client side in ASP.Net CheckBoxList using jQuery
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
    <script type = "text/javascript">
        $("[id*=chkAll]").live("click", function () {
            if ($(this).is(":checked")) {
                $("[id*=chkFruits] input").attr("checked", "checked");
            } else {
                $("[id*=chkFruits] input").removeAttr("checked");
            }
        });
        $("[id*=chkFruits] input").live("click", function () {
            if ($("[id*=chkFruits] input").length == $("[id*=chkFruits] input:checked").length) {
                $("[id*=chkAll]").attr("checked", "checked");
            } else {
                $("[id*=chkAll]").removeAttr("checked");
            }
        });
    </script>
</head>
<body>
    <form id="form1" runat="server">
    Check All: <asp:CheckBox ID="chkAll" runat="server" /><br />
    <asp:CheckBoxList ID="chkFruits" runat="server">
        <asp:ListItem Text="Mango" Value="1"></asp:ListItem>
        <asp:ListItem Text="Apple" Value="2"></asp:ListItem>
        <asp:ListItem Text="Banana" Value="3"></asp:ListItem>
        <asp:ListItem Text="Pineapple" Value="4"></asp:ListItem>
        <asp:ListItem Text="Orange" Value="5"></asp:ListItem>
    </asp:CheckBoxList>
    </form>
</body>
</html>
 
 
Explanation:
In the above code snippet there’s an ASP.Net CheckBox chkAll to which a jQuery click event handler has been assigned. When the chkAll CheckBox is clicked, first I check whether the checkbox is checked or unchecked. If the checkbox is checked I fetch all the checkboxes in the ASP.Net CheckBoxList chkFruits using the selector[id*=chkFruits] input and set their checked attribute and if the checkbox is unchecked then I remove the checked attribute of all the checkboxes in the [id*=chkFruits] input.
Then I have also made sure that if all the checkboxes of the ASP.Net CheckBoxList are checked then check the chkAll checkbox too and if even one checkbox of the ASP.Net CheckBoxList is unchecked I uncheck the chkAll checkbox.
Demo:
Check All: