I have a nullable DateTime in a model and is set to required:
And in a partial view I have:
When the date is left blank, I get the validation error message, but I don't get the red outline styling that is typical with validation errors. A regular text box with the "k-textbox" styling works OK.
[Display(Name =
"Birth Date"
)]
[Required()]
public
DateTime? BirthDate {
get
;
set
; }
And in a partial view I have:
<
div
class
=
"tableRow"
>
<
span
class
=
"tableCellLabelIndent"
>
@Html.LabelFor(m => m.BirthDate)
</
span
>
<
span
class
=
"tableCellInputWide"
>
@Html.EditorFor(m => m.BirthDate, "Date")
@Html.ValidationMessageFor(m => m.BirthDate)
</
span
>
</
div
>
When the date is left blank, I get the validation error message, but I don't get the red outline styling that is typical with validation errors. A regular text box with the "k-textbox" styling works OK.