Hello,
I have a problem with validation message for DatePicker in UI for ASP.NET MVC.
Property in model:
[DataType(DataType.Date, ErrorMessage =
"Please enter a valid date. - TEST"
)]
public
DateTime FromDateTime {
get
;
set
; }
Part of my cshtml file:
@
(Html
.Kendo
()
.DatePickerFor
(model => model.Filter
.FromDateTime
)
.Name
(
"Filter.FromDateTime"
)
.Format
(DateTimeFormats
.DateTimeFormat
)
.ParseFormats
(DateTimeFormats
.ParseFormat
)
.HtmlAttributes
(
new
{
@class
=
"form-control"
, style =
"width: 100%"
})
)
@Html
.ValidationMessageFor
(model => model.Filter
.FromDateTime
,
""
,
new
{
@class
=
"text-danger"
})
This is part of the html page which is generated from the cshtml file:
<input name=
"Filter.FromDateTime"
class
=
"form-control k-input input-validation-error"
id
=
"Filter_FromDateTime"
role=
"combobox"
aria-disabled=
"false"
aria-expanded=
"false"
aria-invalid=
"true"
aria-required=
"true"
aria-describedby=
"Filter_FromDateTime-error"
aria-owns=
"Filter_FromDateTime_dateview"
style=
"width: 100%;"
type=
"text"
value=
"20. 4. 2016"
data-val-required=
"Toto datum musí být vyplněno."
data-val-date=
"The field FromDateTime must be a date."
data-val=
"true"
data-role=
"datepicker"
>
Image of the part of the html page from webbrowser is in file "datepickerError.png".
The problem is in the content of the validation message. Message in my model is "Please enter a valid date. - TEST" but message in html is "The field FromDateTime must be a date."
I want to create localization of this message and change its content. How can I do it?
Thank you for your advice.