I'm trying to get this datepicker field to populate with today's date but it's not happening for some reason. I can't find a reference for what options are accepted in the "new {}" section.
@Html.LabelFor(d => d.ServiceOn, new { @class = "control-label" })
@Html.EditorFor(d => d.ServiceOn, "DatePicker", new { disableMinDate = true, Value = DateTime.Today })
@Html.ValidationMessageFor(d => d.ServiceOn, "", new { @class = "text-danger" })
I've tried value, Value and @Value but the resulting html always shows value="". I'm wondering if maybe the datepicker itself is zeroing out the field. I feel like I'm missing something obvious here.
This should work:
HTMLwork with theModelState, not from the model itself.If you want more loose helpers, ise
@Html.Editorinstead.