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

DxDateEdit<T>.NullValue Property

Specifies a null value for the Date Edit component.

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

A DateTime object that specifies a null value.

#Remarks

Use the NullValue property to specify a null value for the editor.

If the editor is bound to the nullable type, use the NullValue property to override the editor’s null value. Each time a user clears the Date Edit’s content, the editor’s values is set to NullValue. If the NullValue is not specified, the editor’s values is set to NULL.

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

If the component’s Date property is bound to DateTimeOffset or nullable < DateTimeOffset> object, the component ignores the Offset part and compares the DateTime part of DateTimeOffset values to the NullValue property value.

Additionally, use the NullText property to specify the prompt text displayed when the editor is set to a null value. You can also set the ClearButtonDisplayMode to Auto to display the Clear button in the editor when there is a value in it.

Date Edit NullText

Razor
<DxDateEdit @bind-Date="@DateTimeValue"
            ClearButtonDisplayMode="DataEditorClearButtonDisplayMode.Auto"            
            NullText="Select a date..."
            NullValue="@NullValue" ></DxDateEdit>

@code {
    DateTime DateTimeValue { get; set; } 
    DateTime NullValue { get; set; } = new DateTime(2020, 01, 01);
}

Run Demo: Date Edit - Null Date Values and Placeholder

See Also