ASPxFilterControlBase.FilterExpression Property
Gets or sets the current filter expression.
Namespace: DevExpress.Web
Assembly: DevExpress.Web.v19.2.dll
Declaration
Property Value
Type | Default | Description |
---|---|---|
String | String.Empty | A string value that specifies the current filter expression. |
Remarks
To apply the current filter expression, use the ASPxFilterControlBase.ApplyFilter method. This sets the ASPxFilterControlBase.AppliedFilterExpression property to the FilterExpression property’s value.
The example below demonstrates how to specify the filter expression for the ASPxFilterControl. It’s implied that you’ve created the Quantity and UnitPrice filter columns.
protected void Page_Load(object sender, EventArgs e) {
if(!IsPostBack) {
filter.FilterExpression = "Quantity > 10 AND UnitPrice < 30";
// Example2:
// filter.FilterExpression =
// "UnitPrice between(10, 20) AND (Country = 'UK' OR Country = 'USA')";
}
}
The image below shows the result:
The following code shows how to apply the constructed filter expression to an ASPxGridView by clicking an ASPxButton:
protected void ApplyFilterButton_Click(object sender, EventArgs e) {
ASPxFilterControl1.ApplyFilter();
ASPxGridView1.FilterExpression = ASPxFilterControl1.AppliedFilterExpression;
}
To reset the filter expression to a previously applied expression, use the ASPxFilterControlBase.ResetFilter method. This sets the FilterExpression property to the ASPxFilterControlBase.AppliedFilterExpression property’s value.
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the FilterExpression property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.