Skip to main content
Tab

ASPxGridView.ApplyFilterToColumn(GridViewDataColumn, CriteriaOperator) Method

Applies the specified filter criteria to the specified column.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v24.2.dll

Declaration

public virtual void ApplyFilterToColumn(
    GridViewDataColumn column,
    CriteriaOperator criteria
)

Parameters

Name Type Description
column GridViewDataColumn

The data column.

criteria CriteriaOperator

The filter expression.

Remarks

Call the ApplyFilterToColumn method to apply a specific filter criteria to a particular column.

The code sample below calls the ApplyFilterToColumn method to filter the UnitPrice column when the grid is initialized.

<dx:ASPxGridView ID="ASPxGridView1" runat="server" AutoGenerateColumns="False" KeyFieldName="ProductID"
    OnInit="ASPxGridView1_Init">
    <Columns>
        <%--...--%>
        <dx:GridViewDataTextColumn FieldName="UnitPrice" />
    </Columns>
</dx:ASPxGridView>
protected void ASPxGridView1_Init(object sender, EventArgs e) {
    if(!IsPostBack && !IsCallback) {
        var column = (GridViewDataColumn)ASPxGridView1.Columns["UnitPrice"];
        ASPxGridView1.ApplyFilterToColumn(column, CriteriaOperator.Parse("UnitPrice <= 30"));
    }
}

For more information on how to use the ApplyFilterColumn method in the grid, refer to the following example: ASPxGridView - How use ASPxGridLookup as FilterRow editor via FilterTemplate

See Also