Skip to main content

GridCustomizeDataRowEditorEventArgs.IsNewRow Property

Returns whether the editor corresponds to a new or existing row.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.1.dll

NuGet Package: DevExpress.Blazor

Declaration

public bool IsNewRow { get; }

Property Value

Type Description
Boolean

true if the editor is displayed for a new row; false if the editor is displayed for an existing row.

Remarks

The following code snippet handles the CustomizeDataRowEditor event to customize the HireDate column editor in two ways:

  • Limit available hire dates for new employees.
  • Prohibit hire date modification for existing employees.
<DxGrid Data="@employees" PageSize="4" ShowFilterRow="true"
        CustomizeDataRowEditor="OnCustomizeDataRowEditor" >
    <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 OnCustomizeDataRowEditor(GridCustomizeDataRowEditorEventArgs e) {
        if (e.FieldName == "HireDate") {
            var HireDateSettings = e.EditSettings as IDateEditSettings;
            if (e.IsNewRow) {
                // Limit the available hire date for new employees two weeks ahead.
                HireDateSettings.MinDate = @DateTime.Today;
                HireDateSettings.MaxDate = @DateTime.Today.AddDays(14);
            } else {
                // Disable the hire date editing.
                HireDateSettings.Enabled = false;
                HireDateSettings.ShowDropDownButton = false;
            }
        }
    }
}

Limited dates in the calendar editor

See Also