Hi,
I've got a property in my model:
DateTime _ValidTo;
[DisplayName(
"Gültig bis"
)]
[DataType(DataType.Date, ErrorMessage=
"Falsches Datumsfornmat"
)]
[DisplayFormat(DataFormatString =
"{0:dd.MM.yyyy}"
, ApplyFormatInEditMode =
true
), ]
public
DateTime ValidTo
{
get
{
return
_ValidTo; }
set
{ _ValidTo = value; }
}
So in edit-mode the DatePicker is displayed.
But when I pick a a date, a message below the field appears The field "Gültig bis" must be a date.
This Message disappears when I enter the date in yyyy-MM-dd Format, but in ModelState this value is not accepted because of my property-attributes (this is a correct behaviour).
The question is, how can I get the Datepicker setup correctly correspondending my property-attributes?
I'm confused beacuse the Date ist picked correctly (in dd.MM.yyyy Format), but the picker itself does not accept it???
Greetings,
Denis