when I execute the code, I get 4 checkboxes, and I checked / selected all 4 and when I try to debug the code, it considers that I have 4 checkbox, but all 4 checkboxes selected = false.
What am I missing in the code?
<asp:checkboxlist id="chk" runat="server" ondatabinding="chk_DataBinding"
ondatabound="chk_DataBound">
</asp:checkboxlist>
List<String> roles = new List<string>();
for (int i = 0; i < chk.Items.Count; i++)
{
if (chk.Items[i].Selected)
{
roles.Add(chk.Items[i].Value);
}
}
source
share