This is a migrated thread and some comments may be shown as answers.

How to do a Filtered Query

1 Answer 48 Views
LINQ (LINQ specific questions)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
sitefinitysteve asked on 26 Apr 2010, 04:45 PM
I'm trying to do a RadListBox with each ListBox being populated by OA

So ListBox1 has a bunch of people, and ListBox2 has the people linked to that item.

How do I write a query such that the selected people don't show up in the OA result set of people to pick from?  Is there some sort of NOT IN?

1 Answer, 1 is accepted

Sort by
0
Serge
Telerik team
answered on 27 Apr 2010, 05:37 PM
Hi Steve,

 I would suggest you to have a look through these articles and this one in particular. The way to go here is write a LINQ query like so:

var filteredPeople = datasource.Where(x => !selectedPeople.Select(y => y.PersonID).Contains(x.PersonID));

This is assuming your type is Person and id has an identity field PersonID, datasource being the list of people you filter and selectedPeople the ones you do not want to show.

Sincerely yours,
Serge
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
LINQ (LINQ specific questions)
Asked by
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
Answers by
Serge
Telerik team
Share this question
or