tags:

views:

316

answers:

3

hi i am doing an application where i am populating the grid from databse by passsing different parameters to the stored procedure and getting data to a datatable and binding it to the grid view. now i need to have filters applied to the grid so that it should just work like the filters applied to a excel sheet.

can i have some piece of code for applying filters to the gridview with out changing the design of the grid

A: 

Since you are using DataTables, have a look at DataViews, available through setting DataTable.DefaultView

CRice
Firstly Thnaks for the response ! but the thing is here the columns are added to the grid dynamically and i need to have filters on every coloumn of the grid
A: 

Just my two cents, but you can specify a filter expression as the first parameter of DataTable.Select().

I don't know how that goes for you, but it could work out.

MrZombie
A: 

Excellent article here: Basically the sample code at the location allows you to have the drop downs on each column just like in Excel

J Angwenyi