Note that there are some explanatory texts on larger screens.

plurals
  1. POsub model in sub view binding c#
    text
    copied!<p>I have the folowing main model : </p> <pre><code>public class PersonalDetailContainerViewModel { public AprobacionViewModel aprobacionPersonal { get; set; } public AprobacionViewModel aprobacionMinera { get; set; } public PersonalDetailContainerViewModel() { aprobacionPersonal = new AprobacionViewModel(); aprobacionMinera = new AprobacionViewModel(); } } </code></pre> <p>the sub model :</p> <pre><code>public class AprobacionViewModel { [DisplayName("Observación")] public string observation { get; set; } [DisplayName("Responsable")] public string responsable { get; set; } [UIHint("DropDownList")] [DisplayName("Estado")] public IEnumerable&lt;SelectListItem&gt; ListEstado { get; set; } public AprobacionViewModel() { ListEstado = CommonService.createDropDownListEstado(); } } </code></pre> <p>the main view :</p> <pre><code>@model PersonalDetailContainerViewModel @Html.Partial("Aprobacion", Model.aprobacionPersonal) @Html.Partial("Aprobacion", Model.aprobacionMinera) </code></pre> <p>and ... the detail view :</p> <pre><code>@model AprobacionViewModel &lt;fieldset&gt; &lt;legend&gt;Aprobación / Rechazo&lt;/legend&gt; @Html.EditorFor(m =&gt; m.ListEstado, null)&lt;br /&gt; @Html.EditorFor(m =&gt; m.observation, null)&lt;br /&gt; @Html.EditorFor(m =&gt; m.responsable, new { disabled = "disabled" }) &lt;/fieldset&gt; </code></pre> <p>My question, in the binding i receive always a null value for the fields of AprobacionViewModel:</p> <pre><code>[HttpPost] public ActionResult Details(PersonalDetailContainerViewModel model){ model.aprobacionPersonal.observation //NULL ?? } </code></pre> <p>it's possible to use a sub model in a sub view without custom modelbinder ? </p> <p>ps: Darin Dimitrov is my heroe :)) i want a fan page just for click "i like it !" Darin vous êtes mon héros !! ou est votre page facebook pour les fans ?</p>
 

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