ASPxFilterControlBase.FilterExpression Property
Gets or sets the current filter expression.
Namespace: DevExpress.Web
Assembly: DevExpress.Web.v24.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.