Datagridview with Linq

V

Vanessa

I want to develop a datagridview 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
 
N

Nicholas Paldino [.NET/C# MVP]

Vanessa,

You could use LINQ to DataSets to make it easier to perform your
queries, and then produce a DataView from the results. This might be the
easiest to use in your solution if you are already using data sets.

You won't be able to work with anonymous types, but you could still use
projections on non-anonymous types, but you would have to select the items
into a BindingList<T> (or some other collection which implements
IBindingList, so that you could get sort functionality).

I shouldn't say you can't work with anonymous types, but given they are
not meant to be used across methods, you would have an incredibly hard time
doing so (you could technically do it through reflection, but why is beyond
me).
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,

Part of the question is what is your knowledge in each feature?
Most probably you can filter it very easily using a DataView, so maybe a) is
a very easy option.
If you are strong enough on Linq (or want to just practice) you can use it
too. But frankly I would go with the option a)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top