Hi there
I am fairly new at ASP.Net MVC and have a problem i can't seem to figure out.
I have created a web application using VS2015 and C# and the MVC framework. The data base is SQL Server 2014 and I have made use of scaffolding.
I also made use of data annotations to format my date and has apart from other fields 3 date fields which has been annotated as in my model:
[Required(ErrorMessage = "This field is Required!")]
[DataType(DataType.Date)]
in my view I have:
<div class="form-group">
@Html.LabelFor(model => model.DATEREQUIREDBY, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.DATEREQUIREDBY, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.DATEREQUIREDBY, "", new { @class = "text-danger" })
</div>
</div>
I have also set a datepicker with the date formatted as a shortdatestring.
The problem I have is that the date will display correctly in the list of records but when I edit a record in the list (with a date) the date is displayed as mm/dd/yyyy in the form instead of the actual date (21/09/2016) of that record I am trying to edit.
Thanks in advance..
I am fairly new at ASP.Net MVC and have a problem i can't seem to figure out.
I have created a web application using VS2015 and C# and the MVC framework. The data base is SQL Server 2014 and I have made use of scaffolding.
I also made use of data annotations to format my date and has apart from other fields 3 date fields which has been annotated as in my model:
[Required(ErrorMessage = "This field is Required!")]
[DataType(DataType.Date)]
in my view I have:
<div class="form-group">
@Html.LabelFor(model => model.DATEREQUIREDBY, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.DATEREQUIREDBY, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.DATEREQUIREDBY, "", new { @class = "text-danger" })
</div>
</div>
I have also set a datepicker with the date formatted as a shortdatestring.
The problem I have is that the date will display correctly in the list of records but when I edit a record in the list (with a date) the date is displayed as mm/dd/yyyy in the form instead of the actual date (21/09/2016) of that record I am trying to edit.
Thanks in advance..