Skip to main content

GridEditFormTemplateContext.GetEditor(String) Method

Returns an editor that the Grid generated for a column bound to the specified data field.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.1.dll

NuGet Package: DevExpress.Blazor

Declaration

public RenderFragment GetEditor(
    string fieldName
)

Parameters

Name Type Description
fieldName String

The name of a data source field bound to a grid column.

Returns

Type Description
RenderFragment

The column editor.

Remarks

The Grid generates and configures cell editors for individual columns based on associated data types. The Grid displays these cell editors in the filter row and in data rows during edit operations.

Call the GetEditor method to obtain a column editor in the edit form template. The method returns an empty render fragment in the following cases:

  • None of grid columns is bound to the specified data field.
  • The column’s DataRowEditorVisible property is set to false.

The following code snippet displays automatically generated editors in the edit form:

@inject EmployeeService EmployeeData

<style>
    .my-memo-style{
        font-style: italic;
    }
</style>

<DxGrid Data="@employees" PageSize="4" KeyFieldName="ID"
        EditMode="GridEditMode.EditForm">
    <Columns>
        <DxGridCommandColumn />
        <DxGridDataColumn FieldName="FirstName" />
        <DxGridDataColumn FieldName="LastName" />
        <DxGridDataColumn FieldName="BirthDate" />
        <DxGridDataColumn FieldName="HireDate" />
        <DxGridDataColumn FieldName="Notes" Visible="false" >
            <EditSettings>
                <DxMemoSettings Rows="3" 
                                TextAreaCssClass="my-memo-style" 
                                ResizeMode="MemoResizeMode.Disabled" />
            </EditSettings>
        </DxGridDataColumn>
    </Columns>
    <EditFormTemplate Context="EditFormContext">
        <DxFormLayout >
            <DxFormLayoutItem Caption="First Name:" ColSpanMd="6">
                @EditFormContext.GetEditor("FirstName")
            </DxFormLayoutItem>
            <DxFormLayoutItem Caption="Last Name:" ColSpanMd="6">
                @EditFormContext.GetEditor("LastName")
            </DxFormLayoutItem>
            <DxFormLayoutItem Caption="Birth Date:" ColSpanMd="6">
                @EditFormContext.GetEditor("BirthDate")
            </DxFormLayoutItem>
            <DxFormLayoutItem Caption="Hire Date:" ColSpanMd="6">
                @EditFormContext.GetEditor("HireDate")
            </DxFormLayoutItem>
            <DxFormLayoutItem Caption="Notes:" ColSpanMd="12">
                @EditFormContext.GetEditor("Notes")
            </DxFormLayoutItem>
        </DxFormLayout>
    </EditFormTemplate>
</DxGrid>

Edit form with memo

See Also