Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

DxDateEditSettings.NullValue Property

Specifies a null value for the date editor.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

#Declaration

C#
[Parameter]
public DateTime NullValue { get; set; }

#Property Value

Type Description
DateTime

An object that specifies a null value.

#Remarks

If a column is bound to the nullable type, use the NullValue property to override the column editor’s null value. Each time a user clears the editor’s content, the value is set to NullValue.

If a column is bound to the regular (non-nullable) type, specify the NullValue property to allow users to clear column editor content.

You can use the NullText property to specify the prompt text displayed when the editor is set to a null value.

Razor
<DxGrid Data="@employees" PageSize="6" EditMode="GridEditMode.EditRow">
    <Columns>
        <DxGridCommandColumn />
        <DxGridDataColumn FieldName="FirstName" />
        <DxGridDataColumn FieldName="LastName" />
        <DxGridDataColumn FieldName="HireDate" >
             <EditSettings>
                <DxDateEditSettings ClearButtonDisplayMode="DataEditorClearButtonDisplayMode.Auto" 
                    NullText="Select a date..." NullValue="@NullValue"/>
            </EditSettings>
        </DxGridDataColumn>
        <DxGridDataColumn FieldName="Email" />
    </Columns>
</DxGrid>

@code {
    Employee[]? employees;
    DateTime NullValue { get; set; } = new DateTime(2023, 01, 01);

    protected override async Task OnInitializedAsync() {
        employees = await EmployeeData.GetData();
    }
}

To specify the null value at runtime, use the IDateEditSettings.NullValue property instead.

#Implements

See Also