0

I want to display the value from the database in a editorfor field but this stays blank. The value is present in the value field but does not show in the page. enter image description here

enter image description here

if i use the solution from:

Display a formatted date in an EditorFor()

@Html.TextBoxFor(m => m.Van, new { @Value = model.Van.ToString("yyyy/MM/dd"), @class="datepicker" })

I get the value but not the datepicker that is default provided with the EditorFor field.

Model:

[Required]
[DataType(DataType.Date)]
[DisplayFormat(DataFormatString = "{0:dd-MM-yyyy}", ApplyFormatInEditMode = true)]
public DateTime Van{ get; set; }

View:

@Html.EditorFor(model => model.Van, new { htmlAttributes = new { @class = "form-control" } })
Exon02
  • 87
  • 10

1 Answers1

0

this was a Chrome issue after changing the format to "yyyy/MM/dd" it worked.

Exon02
  • 87
  • 10