Back to Devexpress

ASPxFilterControlBase.FilterExpression Property

aspnet-devexpress-dot-web-dot-aspxfiltercontrolbase.md

latest3.5 KB
Original Source

ASPxFilterControlBase.FilterExpression Property

Gets or sets the current filter expression.

Namespace : DevExpress.Web

Assembly : DevExpress.Web.v25.2.dll

NuGet Package : DevExpress.Web

Declaration

csharp
[DefaultValue("")]
public string FilterExpression { get; set; }
vb
<DefaultValue("")>
Public Property FilterExpression As String

Property Value

TypeDefaultDescription
StringString.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.

csharp
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:

csharp
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.

See Also

Criteria Language Syntax

GetFilterExpressionForAccess()

GetFilterExpressionForMsSql()

GetFilterExpressionForOracle()

GetFilterExpressionForDataSet()

Filter Control

ASPxFilterControlBase Class

ASPxFilterControlBase Members

DevExpress.Web Namespace