views:

88

answers:

2

Hello all.

Now this is probably really easy but being the tool that I am, I'm not sure the best way to attack this problem.

I have a DAL and a load of methods using EF that populate drop down lists in a UI. i.e. material, source.

From these, I want the user to populate a gridview with the product data based upon their criteria they select i.e. they could select something from ddlMaterial and something from ddlSource, or nothing from ddlMaterial and something from ddlSource, etc, etc.

How would I go about creating the linq for this?

Is it a case of writing a load of if, and/or statements or is there something a bit more clever I can do - I suspect the latter but being a noob, I need a push in the right direction.

Any help or points in the right direction gratefully received.

+2  A: 

Check out PredicateBuilder, it can be used to generate predicates that can be used to query your DAL.

Matthew Abbott
+1  A: 

If you want to get really dynamic try looking at system.linq.dynamic

You can download the dll here

Richard Friend