MVC 6 VNext how to set HtmlFieldPrefix?

后端 未结 2 1195
名媛妹妹
名媛妹妹 2021-01-18 21:08

My view is divided into partial views. Hence, at the time of submission my model isn\'t reconstructed correctly.

The page view displays employee data, where Employe

2条回答
  •  深忆病人
    2021-01-18 21:40

    If you only need this once this would be the quick solution for the _contactInfo partial view

    employee.cshtml

       @{
            var viewData = new ViewDataDictionary(ViewData);
            viewData.TemplateInfo.HtmlFieldPrefix = "ContactInfo";
        }
    
        
    

提交回复
热议问题