• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 217
  • Last Modified:

LINQ query problem, Please help.

Hi,  
    I am trying to find all the check box that are checked on a html form in an asp.net page using LINQ query and I am having some problem. I am not sure what I am doing wrong.

IEnumerable<string>  cbChecked = Request.Form.Cast<string>().Where(c => c.Contains("cb_"));

I checked the form and it contains all the check boxes check.

Thanks
0
halaharr
Asked:
halaharr
1 Solution
 
johnaryanCommented:
Have you tried:
var cbChecked = Request.Form.OfType<CheckBox>().Select(c => c.Checked);
0
 
halaharrAuthor Commented:
Correct solution was
IEnumerable  cbChecked = Request.Form.OfType().Where(c => c.Contains("cb_"));

But it helped me to to think that option.

Thanks
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now