I’ve got a simple CheckBoxList that I’m using to create some dynamic html on the client, I’m using the value of each checkbox item on the client. The text value comes across fine. The problem I’m having is that the value of each checkbox item comes across as “on” vs the value I set on the server. I’ve tried directly databinding to list, changing where the creation of the list is on the server side (OnInit vs OnPageLoad ) and nothing seems to change it. I’ve gone as far a recreating the control in a separate project and it works fine. Any ideas why the values aren’t coming across? Thanks
Code on the user control
<asp:CheckBoxList ID="cblToolBarButtons" runat="server">
</asp:CheckBoxList>
Server code
foreach (EditorButton editorButton in editorToolBarButtons)
{
ListItem liButton =
new ListItem(
this.ResolveClientUrl(editorButton.ImageUrl).ToString(),
editorButton.Id.ToString()
);
cblToolBarButtons.Items.Add(liButton);
}
Ended up just add the id like this liButton .Attributes.Add(“id”, button.Id.ToString());