?
Solved

LINQ query problem, Please help.

Posted on 2008-09-29
2
Medium Priority
?
209 Views
Last Modified: 2013-11-08
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
Comment
Question by:halaharr
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 5

Accepted Solution

by:
johnaryan earned 1500 total points
ID: 22601264
Have you tried:
var cbChecked = Request.Form.OfType<CheckBox>().Select(c => c.Checked);
0
 
LVL 1

Author Closing Comment

by:halaharr
ID: 31501291
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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question