You can try to add
@{
Html.ViewData.TemplateInfo.HtmlFieldPrefix = "";
}
into the view you contains the Partial view.
Here is a demo:
Models:
public class ParentModel
{
public PartialViewViewModel PartialViewViewModel { get; set; }
public string SomeProperty { get; set; }
}
public class PartialViewViewModel
{
public int Id { get; set; }
}
_MyPartialView.cshtml:
@{
Html.ViewData.TemplateInfo.HtmlFieldPrefix = "PartialViewViewModel";
}
@Html.TextBoxFor(m=>m.Id)
View Containing _MyPartialView:
@{
Html.ViewData.TemplateInfo.HtmlFieldPrefix = "";
}
@model ParentModel
@{Html.RenderPartial("_MyPartialView.cshtml", Model.PartialViewViewModel); }
@Html.HiddenFor(x => x.SomeProperty)
result:
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…