Show theme settings Shopping cart Download trialFree Trial
Change Theme Settings
Change Theme Settings
Themes
 
Show All Themes
v
...v

Custom Filter Functions

Product Name 
Country 
Order Date 
Quantity 
Price 
Discount 
ChangSweden10/11/20212515.2020%
Queso CabralesSweden10/11/20215016.8020%
Nord-Ost MatjesheringSweden10/11/20213520.7020%
Escargots de BourgogneSweden10/11/20213010.6020%
Rogede sildUnited Kingdom12/19/2021157.6020%
Filo MixUnited Kingdom12/19/2021205.6020%
TourtièreBrazil3/26/2021245.9025%
Mishi Kobe NikuGermany4/23/20211697.0015%
Page 1 of 59 (472 items)Prev1234567575859Next
Show filter builder dialogIsSalesDiscount([Discount]) Clear

This demo shows how you can create and register custom filter operators for use with the DevExpress ASP.NET Grid View (ASPxGridView).

Our Grid View control ships with an integrated Filter Control. This control allows users to specify and combine predefined or custom filter conditions. The result is synchronized with the control’s FilterExpression property that you can set in code. Users can specify an expression if they switch from Visual to Text tab in the Filter Control. Use the SettingsFilterControl.ViewMode property to specify tab availability.

This demo implements three custom operators:

  • IsSalesDiscount. Available for the Discount field. Filters out values less than 15% (0.15).
  • DoesNotBeginWith. Available for ProductName and Country fields. Filters out values that begin with the specified argument.
  • IsWeekend. Available for the OrderDate field. Filters out values that don’t fall on weekends.

Review operator implementation in “CustomFunctions.cs”. Each custom operator is a class that implements the ICustomFunctionDisplayAttributes interface. The CriteriaOperator.RegisterCustomFunction method call registers the operator in the Grid View.

You need to explicitly enable custom operators for use in the Filter Control UI. Review C# or VB code-behind file to learn how to do that. The FilterControlOperationVisibility event sets the e.Visible argument to true for applicable operator/field pairs.


See Also:
Collapse/Expand
Local Copy of this Demo
To inspect the source code for this demo on your machine, you must first install our components via the DevExpress Component Installer.
You can open a local copy of this online demo directly from this webpage (if using v20.2.8, 21.1.4 or higher).
Open CS Solution
Open VB Solution
The source code files for this demo are installed (by default) in the following directories:
\Users\Public\Documents\DevExpress Demos XX.X\Components\ASP.NET\CS\ASPxGridViewDemos
\Users\Public\Documents\DevExpress Demos XX.X\Components\ASP.NET\VB\ASPxGridViewDemos