Hello I'm having some trouble uploading to View.
In the database I have this data saved:
Start Date: (datetime) 1998-11-16 00: 00: 00,000
DateTime: (datetime): 1998-11-16 00: 00: 00,000
Timetable (time): 09: 00: 00.0000000
Sida Time (time): 18: 00: 00.0000000
ValueHora (money): 50.00
The values of the "TimeTime", "StartTime" and "DateTime" fields are not being displayed in the VIEW.
And the "InputTime" field triggers this error: "Input string was not in correct format"
Model
[DataType(DataType.Currency)]
[Range(0, 100, ErrorMessage = "Valor deve estar entre {1} e {2}")]
[Display(Name = "Valor hora extra")]
[DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:C0}")]
public decimal? ValorHoraExtra { get; set; }
[DataType(DataType.Date)]
[Display(Name = "Ínicio do contrato")]
[DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:dd/MM/yyyy}")]
public DateTime? DataInicio { get; set; }
[DataType(DataType.Date)]
[Display(Name = "Fim do contrato")]
[DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:dd/MM/yyyy}")]
public DateTime? DataFim { get; set; }
[DataType(DataType.Currency)]
[Range(0, 100, ErrorMessage = "Valor deve estar entre {0} e {1}")]
[Display(Name = "Valor hora")]
[DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:C0}")]
public decimal? ValorHora { get; set; }
[DataType(DataType.Time)]
[Display(Name ="Horário de entrada")]
[DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = @"{0:HH:mm}")]
public TimeSpan? HorarioEntrada { get; set; }
[DataType(DataType.Time)]
[Display(Name = "Horário de saída")]
[DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = @"{0:HH:mm}")]
public TimeSpan? HorarioSaida { get; set; }
View
<div class="form-group">
@Html.LabelFor(model => model.DataInicio, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.DataInicio, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.DataInicio, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.DataFim, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.DataFim, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.DataFim, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.ValorHora, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.ValorHora, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.ValorHora, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.HorarioEntrada, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.HorarioEntrada, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.HorarioEntrada, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.HorarioSaida, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.HorarioSaida, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.HorarioSaida, "", new { @class = "text-danger" })
</div>
</div>
Another thing in the browser, the date fields are not capturing the value when you select the date in the calendar. This is in Chrome. In Firefox, the calendar does not exist.
What is wrong with the code for these errors to occur?