Skip to main content

DxDateEdit<T>.NullValue Property

Specifies a null value for the Date Edit component.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.1.dll

NuGet Package: DevExpress.Blazor

Declaration

[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

<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