Skip to main content
All docs
V24.2

ITextEditSettings.ClearButtonDisplayMode Property

Specifies whether an editor displays the Clear button when the editor is not empty.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

Declaration

[DefaultValue(DataEditorClearButtonDisplayMode.Never)]
[Parameter]
DataEditorClearButtonDisplayMode ClearButtonDisplayMode { get; set; }

Property Value

Type Default Description
DataEditorClearButtonDisplayMode Never

An enumeration value.

Available values:

Name Description
Auto

The clear button is visible when an editor is not empty. This mode requires that the editor’s data type is nullable.

Never

The clear button is not visible.

Remarks

The Clear button allows users to clear the editor’s value (sets it to null). Use the ClearButtonDisplayMode property change the Clear button display mode at runtime. You can use the DxTextEditSettings.ClearButtonDisplayMode property to specify the display mode in markup.

Note that the ClearButtonDisplayMode property does not affect the editor displayed in the filter row whose Clear button is always in Auto mode. You can handle the CustomizeFilterRowEditor event to customize filter row editor settings.

The ITextEditSettings interface allows you to get and customize settings of editors with support for text input. You can get editor settings in the following ways. Note that you can cast settings to the base ITextEditSettings interface or to an editor-specific interface.

  • Call the GetColumnEditSettings method to get editor settings of the column bound to the specified data source field.

    Important

    You need to enclose your code between BeginUpdate and EndUpdate method calls to change values of Grid component parameters outside the Grid component markup. Otherwise, an exception occurs.

    var firstNameEditSettings = e.Grid.GetColumnEditSettings<ITextEditSettings>("FirstName");
    // or var firstNameEditSettings = e.Grid.GetColumnEditSettings<ITextBoxSettings>("FirstName");
    if(firstNameEditSettings != null) {
        e.Grid.BeginUpdate();
        firstNameEditSettings.ClearButtonDisplayMode = DataEditorClearButtonDisplayMode.Auto;
        e.Grid.EndUpdate();
    }
    
  • Handle the CustomizeFilterRowEditor event to customize a cell editor in the filter row.
    void Grid_CustomizeFilterRowEditor(GridCustomizeFilterRowEditorEventArgs e) {
        if(e.EditSettings is ITextEditSettings firstNameEditSettings)
        // or if(e.EditSettings is ITextBoxSettings firstNameEditSettings)
            firstNameEditSettings.ClearButtonDisplayMode = DataEditorClearButtonDisplayMode.Auto;
    }
    
  • Handle the CustomizeDataRowEditor event to customize a cell editor in a data row.
    void Grid_CustomizeDataRowEditor(GridCustomizeDataRowEditorEventArgs e) {
        if(e.EditSettings is ITextEditSettings firstNameEditSettings)
        // or if(e.EditSettings is ITextBoxSettings firstNameEditSettings)
            firstNameEditSettings.ClearButtonDisplayMode = DataEditorClearButtonDisplayMode.Auto;
    }
    
See Also