Wednesday, November 18, 2015

How to get checked values of CheckBoxList in c# using by Linq?

 private string GetCheckedValues(CheckBoxList chkBoxList)
        {
            IEnumerable<string> selectedValues = chkBoxList.Items.Cast<ListItem>()
                             .Where(i => i.Selected)
                             .Select(i => i.Value);
            return string.Join("~", selectedValues);
        }

No comments:

Post a Comment