Note that there are some explanatory texts on larger screens.

plurals
  1. POEdit View for the model that contains the List <T> where T some another class
    primarykey
    data
    text
    <p>It seems I'm tangled up in broad daylight:</p> <p>I have a model classes</p> <pre><code>public class Pilot { //.. other prop-s escaped private List&lt;FlightHoursEntry&gt; FlightHours { get; set; } } public class FlightHoursEntry { public string Description { get; set; } public int Hours { get; set; } } </code></pre> <p>Views are listed bleow, all is displayed correctly, but <strong>on postback FlightHours property is null, Why the engine doesn't initialize the Pilot's object correctly?</strong> </p> <p>in the PilotEditView I'm using <em>@Html.EditorFor(model => model.FlightHours)</em></p> <p>FlightHoursCollectionView is:</p> <pre><code>@model List&lt;FlightHoursEntry&gt; @for (int i = 0; i &lt; Model.Count; i++){ FlightHoursEntry fh = Model[i]; @Html.Partial("~/../FlightHoursEntryEditView.cshtml", fh);} </code></pre> <p>also I've tried this way @Html.EditorFor(model=>model[i], "FlightHoursEntryEditView", fh)</p> <p>and the simple FlightHoursEntryEditView</p> <pre><code>@model PumaMvc.Models.BusinessObjects.Copa.FlightHoursEntry &lt;div class="editor-label"&gt; @Html.LabelFor(model =&gt; model.Hours) &lt;/div&gt; &lt;div class="editor-field"&gt; @Html.EditorFor(model =&gt; model.Hours) @Html.ValidationMessageFor(model =&gt; model.Hours) &lt;/div&gt; &lt;div class="editor-label"&gt; @Html.LabelFor(model =&gt; model.Description) &lt;/div&gt; &lt;div class="editor-field"&gt; @Html.TextAreaFor(model =&gt; model.Description) @Html.ValidationMessageFor(model =&gt; model.Description) &lt;/div&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload