Example 1
This example demonstrates how to assign a filter to a View using the ColumnView.ActiveFilterString property.
C#
gridView1.ActiveFilterString = "([ProductID] = 1 OR [ProductID] = 3 " +
"OR [ProductID] > 10) AND [Discount] = 0";
VB
GridView1.ActiveFilterString = "([ProductID] = 1 OR [ProductID] = 3 " & _
"OR [ProductID] > 10) AND [Discount] = 0"
Example 2
The following code demonstrates how to create filter criteria and assign them to a Grid View via the ColumnView.ActiveFilterCriteria property. The criteria is created using the operators defined in the DevExpress.Data.Filtering namespace (the GroupOperator and BinaryOperator classes). The created criteria represent the filter expression: "[Extension] = '.gif' OR [Extension] = '.png'".
C#
using DevExpress.Data.Filtering;
CriteriaOperator expr1 = new BinaryOperator("Extension", ".gif");
CriteriaOperator expr2 = new BinaryOperator("Extension", ".png");
gridView1.ActiveFilterCriteria = GroupOperator.Or(new CriteriaOperator[] { expr1, expr2 });
VB
Imports DevExpress.Data.Filtering
Dim expr1 As CriteriaOperator = New BinaryOperator("Extension", ".gif")
Dim expr2 As CriteriaOperator = New BinaryOperator("Extension", ".png")
gridView1.ActiveFilterCriteria = GroupOperator.Or(New CriteriaOperator() {expr1, expr2})
No comments:
Post a Comment