Edit this page

Set null or empty value

RadDateTimePicker now has NullableValue property which supports null value (The default Value property is of type DateTime which is value type and it cannot be set to null). The NullableValue property can be set to null as any other reference type, the built-in SetToNullValue method can be used as well:

Set to null

this.radDateTimePicker1.NullableValue = null;
this.radDateTimePicker1.SetToNullValue();

Me.RadDateTimePicker1.NullableValue = Nothing
Me.RadDateTimePicker1.DateTimePickerElement.SetToNullValue()

If you set the NullText property, you can conditionally display a text based on the selected date. The null text will be displayed when the NullableValue is null or when the NullDate property value matches the current value.

Setting the NullText property of RadDateTimePicker

this.radDateTimePicker1.NullText = "No date selected";

Me.RadDateTimePicker1.NullText = "No date selected"

When the NullDate property value is equal to the control value no text will be displayed in the text box part (if the NullText is set it will appear). The default value of the property is MinDate, which is 1/1/1900. Below is the code snippet for setting NullDate to a specific date (01-01-2000):

Setting the NullDate property of RadDateTimePicker

this.radDateTimePicker1.DateTimePickerElement.NullDate = new DateTime(2000, 01, 01);

Me.RadDateTimePicker1.DateTimePickerElement.NullDate = New DateTime(2000, 1, 1)

See Also

Design Time
Free Form Date Time Parsing
MaskDateTimeProvider
Properties
Structure