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.
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" } })