MVC4 - Partial View Model binding during Submit

前端 未结 7 2273
野趣味
野趣味 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:08

    Quick Tip: when calling your EditorFor method, you can set the name of the template as a parameter of the Html.EditorFor method. Alternatively, naming conventions can be your friend; just make sure your editor template filename is exactly the same name as the model property type

    i.e. model property type 'CustomerViewModel' => 'CustomerViewModel.cshtml' editor template.

提交回复
热议问题