vnihues (1) [Avatar] Offline
#1
I want to develop a gridview allowing column selection and filtering, like this:

http://www.codeproject.com/KB/grid/GridFilter.aspx

This example is using dataset. My question is if:
a) I use the same way, using dataset
b) I use Linq converting a query to dataset
c) or if would be done just with Linq

The objective is just for queries and not to update to the database. And Linq would be easy in constructing these queries. So, I would like to use Linq, but I don't want many performance lost using option b described above.

What would be the best option?

Thank you in advance,
Vanessa
jwooley (123) [Avatar] Offline
#2
Re: Gridview using Linq
Assuming this is new code and you are using LINQ elsewhere in your project, I would recommend using LINQ and bind the gridview to the results. Realize that you to do the filtering as shown in the Codeproject link you provided, you will need to dynamically build your filtering expressions manually as the LINQ query expressions are typically more design time rather than runtime constructs. I believe we discuss building dynamic queries in chapter 5.

If it is existing code, unless you have a specific reason to warrent changing your code, you are perfectly fine to leave it. I would only recommend your second option if you are daunted by the task of changing the codeproject solution and adopting it to use LINQ rather than the dataset