ListEditCustomFilteringEventArgs Class
Provides data for the ASPxAutoCompleteBoxBase.CustomFiltering and ASPxListBox.CustomFiltering events.
Namespace: DevExpress.Web
Assembly: DevExpress.Web.v24.1.dll
NuGet Package: DevExpress.Web
Declaration
Remarks
Web Forms: ASPxComboBox.CustomFiltering
<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
@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()
See Also