You need to pass the Date property from your controller.
In your Edit HTTPGet method in the controller return the model e.g. making sure the property passed is a date
Code:var change= await _changeRepo.SelectById(id); //fetch entity from database change.DATEREQUIREDBY=DateTime.Now;//hardcode it to test return View("~/Views/Change/_Edit.cshtml", change);
cshtml
Code:@model IRMS.Models.Change @*on the first line*@ .... @Html.TextBoxFor(model=>model.DATEREQUIREDBY, "{0:dd/MM/yyyy}", new { @class = "form-control" })
My controller has no HTTPGet method, only HTTPPost. See https://www.dropbox.com/s/12w8tceyjs2ozha/CHANGESController.cs?dl=0.
So I have to use @Html.TextBoxFor i.s.o. @Html.EditorFor in Edit.cshtml?
Thanks for your help so far.