Skip to main content

WhereColumnFilterPanel

Namespace: Wisej.Web.Ext.ColumnFilter

Assembly: Wisej.Web.Ext.ColumnFilter (4.1.0.0)

Column filter panel that lets the user build up to five conditions, each made of an operator and a value, combined with AND/OR. The available operators depend on the ValueType of the column.

public class WhereColumnFilterPanel : ColumnFilterPanel

String columns (and DataGridViewComboBoxColumn columns) offer text operators such as equal to, contains, starts with and a "match case" option; the comparison uses the formatted value of the cells. DateTime columns compare only the date part using a date picker. Boolean columns offer is true / is false / is null / is not null. Int32, Int64, Decimal and Double columns offer the relational operators. Other value types are not filtered. The conditions are converted to a System.Linq.Dynamic.Core expression; the expressions of all the filtered columns are combined with AND and evaluated against the rows of the DataGridView.

Example:

Using this panel with the ColumnFilter extender:

this.dataGridView1.Columns["OrderDate"].ValueType = typeof(DateTime);
this.columnFilter1.FilterPanelType = typeof(WhereColumnFilterPanel);
this.columnFilter1.SetShowFilter(this.dataGridView1.Columns["OrderDate"], true);

Constructors​

Instance member WhereColumnFilterPanel()​

Initializes a new instance of the WhereColumnFilterPanel class.

Methods​

Protected member ApplyFilters()​

Applies the filters registered with each column in the order of creation in the Columns collection.

Instance member Clear(applyFilters)​

Clears the filter panel by resetting all the operators, values and dates.

ParameterTypeDescription
applyFilters optionalBooleanTrue (default) to re-apply the filters of all the columns and close the panel.

When no operator is selected the column is not filtered.

Example:

Removing the filter from a specific column:

var panel = this.dataGridView1.Columns["OrderDate"].UserData.FilterPanel as WhereColumnFilterPanel;
panel?.Clear();

Protected member Dispose(disposing)​

Clean up any resources being used.

ParameterTypeDescription
disposingBooleantrue if managed resources should be disposed; otherwise, false.

Protected member OnApplyFilter()​

Invoked when the ColumnFilterPanel should apply the filter criteria selected by the user.

Returns: Boolean. True to indicate that the filter has been applied. False if the filter has been cleared.

Protected member OnBeforeShow()​

Show hide controls based on the ValueType

Implements​