Back to Devexpress

ViewFilter.NonColumnFilter Property

windowsforms-devexpress-dot-xtragrid-dot-views-dot-base-dot-viewfilter-2920d756.md

latest3.6 KB
Original Source

ViewFilter.NonColumnFilter Property

Gets or sets a filter expression that is not associated with any column.

Namespace : DevExpress.XtraGrid.Views.Base

Assembly : DevExpress.XtraGrid.v25.2.dll

NuGet Packages : DevExpress.Win.Grid, DevExpress.Win.Navigation

Declaration

csharp
public string NonColumnFilter { get; set; }
vb
Public Property NonColumnFilter As String

Property Value

TypeDescription
String

A string that specifies a filter expression (not associated with any column) that is applied to the current View.

|

Remarks

Regular column filters are based on column values, and can be modified by users at runtime (using column drop-down menus). For example, the following expression filters data by the “Quantity” and “UnitPrice” columns:

csharp
gridView1.ActiveFilterString = "Quantity > 3 AND UnitPrice > 10";
vb
gridView1.ActiveFilterString = "Quantity > 3 AND UnitPrice > 10"

Non-column filters are used to set up filter conditions for multiple columns at once. For example, the following expression multiplies the unit price and quantity to calculate the total order cost and filter Grid data by that number.

csharp
gridView1.ActiveFilter.NonColumnFilter = "UnitPrice * Quantity >= 50";
vb
gridView1.ActiveFilter.NonColumnFilter = "UnitPrice * Quantity >= 50"

Since this expression is not associated with one specific column, users cannot utilize column drop-down menus to modify it.

Note that if you set up a non-column filter expression that can be translated to regular column filters, a Data Grid will do so automatically.

csharp
gridView1.ActiveFilter.NonColumnFilter = "UnitPrice > 10 AND Quantity >= 3";
// Equal to regular column filter
// gridView1.ActiveFilterString = "UnitPrice > 10 AND Quantity >= 3";
vb
gridView1.ActiveFilter.NonColumnFilter = "UnitPrice > 10 AND Quantity >= 3"
' Equal to regular column filter
' gridView1.ActiveFilterString = "UnitPrice > 10 AND Quantity >= 3"

Example

The following example shows how to assign a filter to a View using the ViewFilter.NonColumnFilter property.

csharp
gridView1.ActiveFilter.Clear();
gridView1.ActiveFilter.NonColumnFilter = "Quantity * UnitPrice >= 100";
vb
GridView1.ActiveFilter.Clear()
GridView1.ActiveFilter.NonColumnFilter = "Quantity * UnitPrice >= 100"

See Also

ActiveFilter

ActiveFilterString

Filter and Search

ViewFilter Class

ViewFilter Members

DevExpress.XtraGrid.Views.Base Namespace