What I need to do:
If a library user selects several categories (like Fiction, Nonfiction, Biography) from a checkbox list, I need to pass all of those selected values from my .aspx page to my .cs page.
My code on my .aspx page:
if (cblGenres.SelectedIndex != -1)
foreach (ListItem cbListItem in cblGenres.Items)
{
if (cbListItem.Selected)
{
string[] cblItems;
ArrayList cblSelections = new ArrayList();
foreach (ListItem item in cblGenres.Items)
{
if (item.Selected)
{
cblSelections.Add(item.Text);
}
}
cblItems = (string[])cblSelections.ToArray(typeof(string));
string.Join(",", cblItems);
}
Authors NewAuthors = new Authors(LibraryID, cblGenresList.SelectedValue);
<asp:CheckBoxList id=&q ...
Go to the complete details ...