asp.net - How to clear selection of a CheckBoxList

CheckBoxList ClearSelection method
CheckBoxListClearSelectionMethod.aspx

<%@ Page Language="C#" AutoEventWireup="true" %>

<!DOCTYPE html>

<script runat="server">
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        CheckBoxList1.ClearSelection();
    }
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>How to use CheckBoxList ClearSelection method in asp.net</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <h2 style="color:MediumOrchid; font-style:italic;">
            How to use CheckBoxList
            <br /> ClearSelection method in asp.net
        </h2>
        <hr width="325" align="left" color="Plum" />
        <asp:Label 
            ID="Label1"
            runat="server"
            >
        </asp:Label>
        <asp:CheckBoxList
             ID="CheckBoxList1"
             runat="server"
             Font-Size="Large"
             Font-Underline="true"
             Font-Names="Comic Sans MS"
             Font-Italic="true"
             Font-Bold="true"
             ForeColor="RoyalBlue"
             >
             <asp:ListItem Text="Moccasin"></asp:ListItem>
             <asp:ListItem Text="PeachPuff" Selected="True"></asp:ListItem>
             <asp:ListItem Text="Plum"></asp:ListItem>
             <asp:ListItem Text="WhiteSmoke" Selected="True"></asp:ListItem>
             <asp:ListItem Text="Peru"></asp:ListItem>
        </asp:CheckBoxList>
        <br />
        <asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="Clear Selection (Deselect CheckBoxList)"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            />
    </div>
    </form>
</body>
</html>
More asp.net examples