2
In my model have a field DateTime
called Dating, I graduated with Attributes
, but when I’m in view is filling in hh:mm:ss
I just want the date 29/02/2016.
Model
[Column("sdt_DataReferencia")]
[DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:dd/MM/yyyy}")]
[Display(Name = "Referência 01/mm/aaaa")]
public DateTime DataReferencia { get; set; }
View:
<div class="form-group">
@Html.LabelFor(model => model.Boletos.DataReferencia, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.Boletos.DataReferencia, new { htmlAttributes = new { @class = "form-control", @Value = Model.Boletos.DataReferencia }, })
@Html.ValidationMessageFor(model => model.Boletos.DataReferencia, "", new { @class = "text-danger" })
</div>
</div>
the first is very interesting, but as I will use hh:mm:ss in some views then I will go to Alternative 1
– Dorathoto
I also had to take it out of Html.Edit @Value = Model.Validatededits, this also made the values wrong
– Dorathoto