My model has the property:
[Required] [DataType(DataType.Date)] public DateTime BirthDate { get; set; }
which I show in my (strongly typed) view using EditorFor:
<p>@Html.LabelFor(m => m.BirthDate) @Html.EditorFor(m => m.BirthDate) @Html.ValidationMessageFor(m => m.BirthDate) </p>
When the view is rendered, the text field of the date of birth shows "01.01.0001", that is, the default value is DateTime. This is correct if the BirthDate is not initialized, however I want the text box to be empty in this case.
What is the standard way to do this? I do not want to use Nullable <DateTime> in my model because BirthDate is a required value.
source share