It seems I'm tangled up in broad daylight:
I have a model classes
public class Pilot
{
//.. other prop-s escaped
private List<FlightHoursEntry> FlightHours { get; set; }
}
public class FlightHoursEntry
{
public string Description { get; set; }
public int Hours { get; set; }
}
Views are listed bleow, all is displayed correctly, but on postback FlightHours property is null, Why the engine doesn't initialize the Pilot's object correctly?
in the PilotEditView I'm using @Html.EditorFor(model => model.FlightHours)
FlightHoursCollectionView is:
@model List<FlightHoursEntry>
@for (int i = 0; i < Model.Count; i++){
FlightHoursEntry fh = Model[i];
@Html.Partial("~/../FlightHoursEntryEditView.cshtml", fh);}
also I've tried this way @Html.EditorFor(model=>model[i], "FlightHoursEntryEditView", fh)
and the simple FlightHoursEntryEditView
@model PumaMvc.Models.BusinessObjects.Copa.FlightHoursEntry
<div class="editor-label">
@Html.LabelFor(model => model.Hours)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.Hours)
@Html.ValidationMessageFor(model => model.Hours)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.Description)
</div>
<div class="editor-field">
@Html.TextAreaFor(model => model.Description)
@Html.ValidationMessageFor(model => model.Description)
</div>