MVC4 - Partial View Model binding during Submit

前端 未结 7 2232
野趣味
野趣味 2021-02-19 19:29

I have view model which has another child model to render the partial view (below).

public class ExamResultsFormViewModel
{
    public PreliminaryInformationView         


        
7条回答
  •  甜味超标
    2021-02-19 20:11

    Please make the below changes to your partial page. so it will come with your Parent model

    //Parent Page
    @{Html.RenderPartial("_PreliminaryInformation", Model.PreliminaryInformation);}
    
    //Partial Page
    @model Web.Models.Preliminary.PreliminaryInformationViewModel
    @using (Html.BeginCollectionItem("PreliminaryInformation", item.RowId, true))
        {
    
    @Html.TextBoxFor(x => x.DateOfService })
    }

提交回复
热议问题