posted on Saturday, July 31, 2004 1:44 PM
by
warstar
Get all selected values checkboxList
Hey all,
I had a small problem when working with a check box list because when you say CheckBoxList1.SelectedValue you only get the first value selected not all the selected values.
To get all the selected values u will need to go true all the items like the following code dues
foreach(ListItem item in ((CheckBoxList1)Page.FindControl(dr.id.ToString())).Items)
{
if (item.Selected)
{
Label1.Text += item.Value+“, “;
}
}
Why isn't there just a way to get like CheckBoxList1.SelectedValues and get back a array with all selected values? A wll you can't have it all
Happy netting,
Warnar