Filtering a DataGridView for each column with filters visible above the columns

I have a rather specific request -

I want to be able to retrieve data from a database, display it in a DataGridView, and allow users to filter columns by entering simple filter queries above each column.

For example: -

        | Foo   | Bar                 | Baz |
        ------------------------------------|
Filters | > 10  | 1/1/1980 - 1/1/2009 | Boo |
        | 12    | 1/3/1995            | Boo |
        | 99    | 5/12/2005           | Boo |
                     etc.

The method that I thought was the best solution to this problem was to have two data tables that act like a DataSource for a DataGridView (so that I can have a view to auto-generate columns and not write a whole bunch of templates to insert rows myself) , which itself consists of one line for storing filters and database data underneath, and the second for storing database data that can be programmatically added to the first.

, , Foo , Bar DateTime, Baz - . Foo Bar DataGridView , , .

, , ?

, , , , , WinForms, , , 3 , - WinForms.

, - WPF, DataGridView (, , DGV OSS ).

, ( ). .

- ? , , !: -)

+3
2

, . DataGridViewColumnHeaderCell . , , , Microsoft, . , , .

http://msdn.microsoft.com/en-us/library/aa480727.aspx

, , DataTable DataView, DataView. RowFilter, . . , RowFilter:

http://msdn.microsoft.com/en-us/library/system.data.dataview.rowfilter.aspx

+1

Source: https://habr.com/ru/post/1716111/


All Articles