Skip to main content
All docs

FilterControlOperationVisibilityEventArgs.CustomFunctionName Property

Gets a custom filter function name.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v23.1.dll

NuGet Package: DevExpress.Web


public string CustomFunctionName { get; }

Property Value

Type Description

A function name.


Use the CustomFunctionName property to obtain the name of the custom filter function. For a comparison operator based on the custom function, the Operation property value is Function and the FunctionType property value is Custom.

Implement an Operator Based on a Custom Function

The example below demonstrates how to implement a custom operator (“Does not begin with”) for the grid’s filter builder. This operator allows users to hide grid rows whose values in the specified column begin with the entered string value.

CustomFunctionName Property

Create a class that implements the ICustomFunctionDisplayAttributes interface to define a function displayed as an operator. This interface extends the ICustomFunctionOperatorBrowsable interface with the following properties:

Specifies the operator’s caption.
Specifies the operator’s image. You can set this property to Image, SvgImage, and ImageProperties class instances or an image’s URL string.

The function can accept one or two operands:

  • The first operand holds a field value.

  • The second operand holds a user-entered value. The function compares it to the field value.

using DevExpress.Data.Filtering;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

public class DoesNotBeginWithFunction : ICustomFunctionDisplayAttributes {
    public const string FunctionName = "DoesNotBeginWith";
    public static readonly DoesNotBeginWithFunction Instance = new DoesNotBeginWithFunction();
    DoesNotBeginWithFunction() { }

    #region ICustomFunctionOperatorBrowsable Members
    FunctionCategory ICustomFunctionOperatorBrowsable.Category {
        get { return FunctionCategory.Text; }
    string ICustomFunctionOperatorBrowsable.Description {
        get { return "Selects items that do not start with the specified string."; }
    bool ICustomFunctionOperatorBrowsable.IsValidOperandCount(int count) {
        return count == 2;
    bool ICustomFunctionOperatorBrowsable.IsValidOperandType(int operandIndex, int operandCount, Type type) {
        return type == typeof(string);
    int ICustomFunctionOperatorBrowsable.MaxOperandCount {
        get { return 2; }
    int ICustomFunctionOperatorBrowsable.MinOperandCount {
        get { return 2; }
    #region ICustomFunctionDisplayAttributes
    string ICustomFunctionDisplayAttributes.DisplayName {
        get { return "Does not begin with"; }
    object ICustomFunctionDisplayAttributes.Image {
        get { return "~/Content/CustomFunctions/notbeginwith.svg"; }
    #region ICustomFunctionOperator Members
    //The first operand (operands[0]) is the field value to process.
    //The second operand (operands[1]) is the value specified in the filter editor.
    object ICustomFunctionOperator.Evaluate(params object[] operands) {
        if (operands[0] != null && operands[1] != null) {
            string str1 = operands[0].ToString();
            string str2 = operands[1].ToString();
            return !str1.StartsWith(str2, StringComparison.InvariantCultureIgnoreCase);
        return false;
    string ICustomFunctionOperator.Name {
        get {
            return FunctionName;
    Type ICustomFunctionOperator.ResultType(params Type[] operands) {
        return typeof(bool);

Call the CriteriaOperator.RegisterCustomFunction or CriteriaOperator.RegisterCustomFunctions method to register the custom function class.

protected void Page_Init(object sender, EventArgs e) {

Initially, the filter control does not display an operator based on the created function. Handle the corresponding event to set the e.Visible property to true for the operator:

<dx:ASPxGridView ID="grid" runat="server"
        <dx:GridViewDataTextColumn FieldName="ProductName" />
    <Settings ShowFilterBar="Visible" />
protected void grid_FilterControlOperationVisibility(object sender, FilterControlOperationVisibilityEventArgs e) {
    if (e.PropertyInfo.PropertyName == "ProductName" || e.PropertyInfo.PropertyName == "Country") {
        List<ClauseType> availableOperators = new List<ClauseType>() {
        if (availableOperators.Contains(e.Operation) ||
           (e.FunctionType == FunctionOperatorType.Custom && e.CustomFunctionName == "DoesNotBeginWith"))
            e.Visible = true;
            e.Visible = false;
See Also