How to remove all item from CheckBoxList in asp.net c#

How to remove all item from CheckBoxList, items clear
CheckBoxListItemClear.aspx
<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

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

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>How to remove all item from CheckBoxList, items clear</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <h2 style="color:Green">CheckBoxList: Items Clear</h2>
        <asp:Label 
             ID="Label1"
             runat="server"
             Font-Bold="true"
             ForeColor="DarkGoldenrod"
             Text="asp.net controls"
             >
        </asp:Label>
        <asp:CheckBoxList 
             ID="CheckBoxList1"
             runat="server"
             BorderColor="Crimson"
             BorderWidth="2"
             >
             <asp:ListItem>Timer</asp:ListItem>
             <asp:ListItem>Wizard</asp:ListItem>
             <asp:ListItem>ConnectionsZone</asp:ListItem>
             <asp:ListItem>Table</asp:ListItem>
             <asp:ListItem>ImportCatalogPart</asp:ListItem>
        </asp:CheckBoxList>
        <br /><br />
        <asp:Button 
             ID="Button1"
             runat="server"
             Font-Bold="true"
             ForeColor="DarkGoldenrod"
             Text="Clear Item"
             OnClick="Button1_Click"
             />
    </div>
    </form>
</body>
</html>






Related asp.net example