Decorate the property in your model with the DataType
attribute, and specify that its a Date
, and not a DateTime
:
public class Model {
[DataType(DataType.Date)]
public DateTime? Due { get; set; }
}
You do have to use EditorFor
instead of TextBoxFor
in the view as well:
@Html.EditorFor(m => m.Due)