MVC4 - Partial View Model binding during Submit

前端 未结 7 2277
野趣味
野趣味 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 19:57

    You can add the HtmlFieldPrefix to the top of your partial view:

    @{
        ViewData.TemplateInfo.HtmlFieldPrefix = "Contact";
    }
    

    This is the same approach as that described by @cpoDesign but it means you can keep the prefix in your partial view if you need to do that.

提交回复
热议问题