How do I filter post-databind gridview results?

jazjef
jazjef used Ask the Experts™
on
I'm using Visual Web Developer, SQL Server management Studio Express, and VB.NET backcoding.

Q:  I have an SQL database with about 500 records and 100 fields. I want to filter post-databind results in a gridview using drop-down lists. Example: 'age' has 5 categories, 'gender' has 2 categories, 'income' has 5 categories. How can i do this? Other solutions I have seen don't seem to be what I'm looking for...


NOTE:  
I have a successful method that uses checkboxes where the user can select any combination of fields, then click a button to populate the gridview, and then click another button to send gridview results to Excel and then use the autofilter in Excel. THIS METHOD WORKS GREAT AND IS REALLY SIMPLE. However, the boss wants gridview results filtered after the intitial databind and would rather not send the preliminary results to Excel for subfiltering like I suggested we do......management prefers I do a whole bunch more coding rather than use Excel to do something it does really well. Any  help is appreciated.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Commented:
I dont know if this will help.  What I did was create extra datasources for each of my filters.  ie. One for age, one for gender, one for income, one for age and gender, etc.    Then based on what was selected. Changed the gridview databinding to the correct datasourse and re- databind().  

Issue with excel that I found out, is if your server is window 2008 64bit, it will not allow you to call excel to do your work.

Commented:
I think you should apply a filter to your data source.
There's an excellent explanation down here:
http://www.eggheadcafe.com/tutorials/aspnet/c67c4daa-83c2-4baa-aea4-2c8855527acb/aspnet-gridview-filterin.aspx

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial