I'm populating multiple CheckBoxList from the database in the codebehind. But when I click the update button, all the items vanish.

Page Load
enter image description here

When Update button click
enter image description here

The page_load !IsPostBack
cblLanguage.DataSource = GenericClass.GetCheckboxList(4);

cblLanguage.DataValueField = "keyfield";

cblLanguage.DataTextField = "textfield";

cblLanguage.DataBind();

cblLanguage.EnableViewState = true;

aspx code:

<h1>Language</h1>

<asp:CheckBoxList runat="server" ID="cblLanguage" RepeatColumns="10" CssClass="checkboxlist_nowrap" Width="100%" />

I'm not sure what I'm missing. I'm enabling the view state for all the CheckBoxLists, but they all vanish when the page is reloaded to save the data. The GetCheckboxList is a static public DataTable which works when the page loaded. Thanks in advance.

Alverant's user avatar

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.