I have a DataHora field and wanted to use separate, that is, a single field in the database called DateHora of type datetime, and manipulate this field with two editorfor where I saved the date of one editorfor and the time of another editorfor in the same database field:
View:
<div class="form-group">
@Html.LabelFor(model => model.DataHora, "Liberar encomenda as", htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.DataHora, new { htmlAttributes = new { @class = "form-control" } }) Horas
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.DataHora, "Liberar encomenda dia", htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.DataHora, new { htmlAttributes = new { @class = "form-control" } })
</div>
</div>
Class:
public DateTime DataHora { get; set; }