I have a checkbox list which is getting its list items from a database using the binding as shown in the snippet below:
CheckBoxList1.DataSource = GetValues();
CheckBoxList1.DataBind();
GetValues():
var query = tran_DContext.get_ImportTabs();
foreach (var item in query)
{
TabList.Add(item.TabName);
}
return TabList;
The above snippet successfully retrieves the column TabName and places it in the checkboxlist. But when the checkbox is selected on the website, the 'selection' value doesn't flow to my code. Am i missing something? i have the following code:
private List<string> SelectedTabs()
{
string strTemp = string.Empty;
List<string> Seltabs = new List<string>();
foreach (ListItem lst in CheckBoxList1.Items)
{
if (lst.Selected)
Seltabs.Add(CheckBoxList1.SelectedValue);
}
return Seltabs;
}
help?