Skip to main content
All docs
V24.2

DxGrid.GetColumnEditSettings<T>(String) Method

Returns editor settings of the column bound to the specified data source field.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

Declaration

public T GetColumnEditSettings<T>(
    string fieldName
)
    where T : class, IEditSettings

Parameters

Name Type Description
fieldName String

A data source field name.

Type Parameters

Name Description
T

An editor setting type.

Returns

Type Description
T

An object that contains editor settings.

Remarks

The Grid component generates and configures cell editors for columns based on associated data types. The component automatically displays column editors in the filter row and in data rows during edit operations. You can also place these editors in the edit or pop-up edit form.

Edit and Filter Rows

The Grid allows you to access and customize editor settings at runtime. To get editor settings, pass a setting type and the corresponding data source field name to the GetColumnEditSettings method. The method returns null in the following cases:

  • The Grid does not have a column bound to the specified field
  • Editor settings of the column bound to the specified field are of a different type

Note

Editors, their settings, and types can change after you bind the Grid or its column to another data source. If the Grid is bound to an asynchronous data source, editor types can also change during Grid initialization.

The following code snippet enables an editor in the edit row for new rows only:

Date Edit in Grid

@inject EmployeeService EmployeeData

<DxGrid Data="@employees" 
        EditMode="GridEditMode.EditRow" 
        EditStart="OnEditStart">
    <Columns>
        <DxGridCommandColumn />
        <DxGridDataColumn FieldName="FirstName" />
        <DxGridDataColumn FieldName="LastName" />
        <DxGridDataColumn FieldName="BirthDate" />
        <DxGridDataColumn FieldName="HireDate" />
        <DxGridDataColumn FieldName="Email" />
    </Columns>
</DxGrid>

@code {
    Employee[]? employees;
    protected override async Task OnInitializedAsync() {
        employees = await EmployeeData.GetData();
    }
    void OnEditStart(GridEditStartEventArgs e) {
        var settingsHireDate = e.Grid.GetColumnEditSettings<IDateEditSettings>("HireDate");
        if (settingsHireDate != null) {
          e.Grid.BeginUpdate();
          settingsHireDate.Enabled = e.IsNew;
          settingsHireDate.ShowDropDownButton = e.IsNew;
          e.Grid.EndUpdate();
        }
    }
}

Handle the Grid’s CustomizeFilterRowEditor event to customize editors in the filter row. The CustomizeDataRowEditor event allows you to customize editors displayed in data rows, edit forms, or pop-up edit forms.

See Also