ASPxGridBase.FilterExpression Property
Gets or sets the filter criterion which is applied to the grid.
Namespace: DevExpress.Web
Assembly: DevExpress.Web.v22.1.dll
Declaration
Property Value
Type | Default | Description |
---|---|---|
String | A String value that specifies the filter criterion. |
Remarks
Concept
Examples
The following examples illustrate different scenarios on how to filter the grid data.
Filter data by dates.
Applying a filter that selects departments whose budget is greater than 100,000 and that are located in Monterey. The filter criteria are displayed within the ASPxGridView’s Title Panel.
ASPxGridView1.FilterExpression = "[Budget] > 100000 AND [Location] = 'Monterey'"; ASPxGridView1.SettingsText.Title = ASPxGridView1.FilterExpression;
Result:
Select data rows whose product name starts with “ch”.
Get field names from the filter expression value.
int start = -1; List<string> fields = new List<string>(); for (int i = 0; i < ASPxGridView1.FilterExpression.Length; i++) { if (ASPxGridView1.FilterExpression[i] == '[') start = i; if (ASPxGridView1.FilterExpression[i] == ']') { fields.Add(ASPxGridView1.FilterExpression.Substring(start + 1, i - start - 1)); start = -1; } }
Online Demos
See Also