I have a DateTime field(that can accept multiple date time formats, so it is pain to create Regex patter)
When in the field I'm entering something like "Aaaaaa", I'm getting error message:
The value 'Aaaaa' is not valid for OwnerBirthDate
Model looks:
[DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:dd.MM.yyyy}")]
[Required(ErrorMessage = "*")]
public DateTime? OwnerBirthDate { get; set; }
View:
@Html.TextBoxFor(x => x.OwnerBirthDate)
How can I define custom error message for this particular field?
Thank you
You can use ValidationMessageFor to apply a custom message if you want a different message to one pre defined in an attribute