Solved

LINQ query problem, Please help.

Posted on 2008-09-29
2
191 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
2 Comments
 
LVL 5

Accepted Solution

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

Author Closing Comment

by:halaharr
Comment Utility
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

771 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now