To get values from checkbox list using linq in
a single line of code.
var values = CheckBoxList1.Items.Cast<ListItem>().Where(n =>
n.Selected).Select(n => n.Value).ToList();
use using System.Linq; as namespace.
values will return all checkboxlist values in
list<> form.
I realized that linq is the best option to get
value from any type of list by using just 2 to 3 line of code.