1.In my ASP.NET projects for each grid view I used the
Entity Framework
and
Stored Procedure
(shortly SP) with filter parameters, so the
WHERE
clause is dynamically build inside of the SP by using these filter parameters.
You could see details (and source code) about this technique in my next article
Advanced ASPX GridView Pagination and Data Entities[
^]
2. Other solution, without SP, could be to dynamically create LINQ query based on the filter parameters. I am using this technique in my new ASP.NET MVC projects.