i have this razor view:
<div class="panel-body">
<div class="form-group row">
<div class="col-sm-6">
@Html.LabelFor(model => model.DrivingLicenceNo, "Licence No", htmlAttributes: new { @class = "control-label" })
@Html.EditorFor(model => model.DrivingLicenceNo, new { htmlAttributes = new { @class = "form-control" } })
</div>
<div class="col-sm-6">
@Html.LabelFor(model => model.DrivingLicenceExpiryDate, "Expiry Date", htmlAttributes: new { @class = "control-label" })
@Html.EditorFor(model => model.DrivingLicenceExpiryDate, new { htmlAttributes = new { @class = "form-control" } })
</div>
</div>
<div class="form-group row">
<div class="col-sm-6">
@Html.LabelFor(model => model.DrivingLicenceImage, "Licence Image", htmlAttributes: new { @class = "control-label" })
<input type="file" name="uploadFile" />
</div>
<div class="col-sm-6">
@Html.LabelFor(model => model.DateofBirth, "Date of Birth", htmlAttributes: new { @class = "control-label" })
@Html.EditorFor(model => model.DateofBirth, new { htmlAttributes = new { @class = "form-control" } })
</div>
</div>
</div>
and to display dates, i am using the following script:
<script>
$(function() {
$("#DrivingLicenceExpiryDate").datepicker({
changeMonth: true,
changeYear: true,
dateFormat: 'dd-mmm-yyyy'
});
$("#DateofBirth").datepicker({
changeMonth: true,
changeYear: true,
dateFormat: 'dd-mmm-yyyy'
});
});
however without using the script, i get the dates populated in the post action method model but when i put the script back in, the dates in the model object does not get populated. i need to display the drop down menu to make it easier for the user to pick dates