Display Datepicker in Editor onload instead of needing the user to pick

Viewed 169

currently I have this datepicker which will hightlight today's date on the pop up calender but the editor for the date onLoad shows DD/MM/YYYY instead of aotopopulating it when the page loads. How do I solve this ?

This is how I display my datepicker in the html file:

<div class="form-group">
    @Html.LabelFor(model => model.date, htmlAttributes: new { @class = "control-label col-md-2" })
    <div class="col-md-10">
        @Html.EditorFor(model => model.date)
        @Html.ValidationMessageFor(model => model.date)
    </div>
</div>

And this is how I define it:

[DataType(DataType.Date)]
[DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:d}")]
1 Answers
Related