Linq to CheckBoxList in

by Otto on October 21, 2008

Linq is pretty amazing.  I’m working on a feature for Boardroom Web where a person can select multiple items that are in a CheckBoxList.  I wanted a quick and easy way to read all of the items they checked.  Here’s the Linq statement to read everything that is checked:

var selectionResults = from ListItem item in cblAnswers.Items
where item.Selected == true
select item;

I’m not sure if I’m using Linq just to use Linq, but sure seems like a very simple way to get what I needed in this case.

Comments on this entry are closed.

Previous post:

Next post: