Click here to Skip to main content
15,912,205 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to iterate through checked list box in asp.net
and set reset its checked status.

please help
Posted

1 solution

XML
<asp:CheckBoxList ID="CheckBoxList1" runat="server">
            <asp:ListItem Selected="True">FirstCheckBox</asp:ListItem>
            <asp:ListItem>SecondCheckBox</asp:ListItem>
            <asp:ListItem>ThirdCheckBox</asp:ListItem>
            <asp:ListItem>FourthCheckBox</asp:ListItem>
        </asp:CheckBoxList>
        <br />
        <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Reset" />

C#
protected void Button1_Click(object sender, EventArgs e)
    {
        for (int i = 0; i < CheckBoxList1.Items.Count; i++)
        {
            CheckBoxList1.Items[i].Selected = false;
        }
    }
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900