I have a checkbox list that isn’t updating on the looping through it.
<asp:CheckBoxList ID="cblRoles" runat="server">
</asp:CheckBoxList>
Pretty straight forward, the code behind:
List<ListItem> listRoles = AdminRole.GetRolesList(false);
cblRoles.DataSource = listRoles;
cblRoles.DataValueField = "Value";
cblRoles.DataTextField = "Text";
cblRoles.DataBind();
foreach (ListItem listItemRoles in cblRoles.Items)
{
listItemRoles.Enabled = true;
listItemRoles.Selected = true;
listItemRoles.Text = "test";
listItemRoles.Value = "test";}
The data inside the checkbox list isn’t updating at all, even though the stepthrough debugger seems to work as expected. It does bring out the list as expected in the function that calls the data. FYI this is inside the (!isPostBack) check so that it isn’t rebinding it again. I am stumped as to why this isn’t working.
That Text & Value I Love! But it seems that you are re-assigning values? you did already bind it.