How to do a Filtered Query

2 posts, 0 answers
  1. Steve
    Steve avatar
    1851 posts
    Member since:
    Dec 2008

    Posted 26 Apr 2010 Link to this post

    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?
  2. Serge
    Admin
    Serge avatar
    375 posts

    Posted 27 Apr 2010 Link to this post

    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.
  3. DevCraft banner
Back to Top