I’m using .NET 3.5, C#, and WinForms.
My grid has lots of columns: SellerName, BuyerName, LoadType, LoadName, DriverName, CarSerialNumber, etc. I want to filter the BindingSource. I did this using ComboBoxes which is filled on DropDown with the grid cells’ values, but it’s not practical and makes for a bad-looking form.
I need advice on what is the best way to let the user choose values of the grid and then filter with a button. Can I make it like in Excel? There is a button on the column header, and when the user presses it, it shows a little menu with a checked list box. When the user checks any values and press a button it begins filtering.
Please advise me something.
This is pic of Excel:

Thanks!
Well,
first of all you should create your custom filter usercontrol, as similar as you wish to the one in excel.
Secondly, it’s not easy to do, but you could add filter buttons to the grid (simply doing
grid.Controls.Add(...)) and keep them aligned with columns’ headers by overridingOnColumnWidthChanged/OnColumnHeadersHeightChangedofDatagridView.Finally, when user clicks on filter button, you can open a
ToolStripDropDownwith your custom filter embedded in it, I mean something similar to this answer (obviously with your control instead of the listview):DropDown Menu with ScrollBar in .NET
EDIT:
Here’s a (working) code sample:
Custom Column Header Cell Class:
Custom Event Args:
DataGridView Override:
Result:
EDIT 2:
Here’s a full VS2008 project sample (DataGrid with customized filter, not just “Hello World”): –> http://www.mediafire.com/?s6o8jmpzh0t82v2