I\'m trying to loop through items of a checkbox list. If it\'s checked, I want to set a value. If not, I want to set another value. I was using the below, but it only gives
This will give a list of selected
List items = checkboxlist.Items.Cast().Where(n => n.Selected).ToList();
This will give a list of the selected boxes' values (change Value for Text if that is wanted):
var values = checkboxlist.Items.Cast().Where(n => n.Selected).Select(n => n.Value ).ToList()