Skip to main content
Tab

ListEditCustomFilteringEventArgs Class

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v24.1.dll

NuGet Package: DevExpress.Web

Declaration

public class ListEditCustomFilteringEventArgs :
    EventArgs

Remarks

Web Forms: ASPxComboBox.CustomFiltering

Run Demo: ASPxComboBox - Custom Filtering

<dx:ASPxComboBox ID="ComboBox1" runat="server" OnCustomFiltering="ComboBox1_CustomFiltering">
    <Columns> <!-- ... --> </Columns>
</dx:ASPxComboBox>
protected void ComboBox1_CustomFiltering(object sender, DevExpress.Web.ListEditCustomFilteringEventArgs e) {
    string[] words = e.Filter.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
    string[] columns = new string[] { "CompanyName", "Country" };
    e.FilterExpression = GroupOperator.And(words.Select(w => 
        GroupOperator.Or(
            columns.Select(c => 
                new FunctionOperator(FunctionOperatorType.Contains, new OperandProperty(c), w)
            )
        )
    )).ToString();
    e.CustomHighlighting = columns.ToDictionary(c => c, c => words);
}

MVC: ComboBoxSettings.CustomFiltering

Run Demo: MVC ComboBox - Custom Filtering

@Html.DevExpress().ComboBox(settings => {
    settings.Name = "cmbWithServerFiltering";
    settings.Properties.Columns.Add(column => {
        column.FieldName = "CompanyName";
    });
    settings.Properties.Columns.Add(column => {
        column.FieldName = "Country";
    });
    <!-- ... -->
    settings.CustomFiltering += (s, e) => {
        string[] words = e.Filter.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
        string[] columns = new string[] { "CompanyName", "Country" };
        e.FilterExpression = GroupOperator.And(words.Select(w => 
            GroupOperator.Or(
                columns.Select(c => 
                    new FunctionOperator(FunctionOperatorType.Contains, new OperandProperty(c), w)
                )
            )
        )).ToString();
        e.CustomHighlighting = columns.ToDictionary(c => c, c => words);    
    };
}).BindList(Model).GetHtml()

Inheritance

Object
EventArgs
ListEditCustomFilteringEventArgs
See Also