Razor view engine - How can I add Partial Views

前端 未结 2 871
误落风尘
误落风尘 2021-01-31 06:58

I was wondering what, if it is possible, is the best way to render a partial using the new razor view engine. I understand this is something that wasn\'t finished completely by

2条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-31 07:29

    You partial looks much like an editor template so you could include it as such (assuming of course that your partial is placed in the ~/views/controllername/EditorTemplates subfolder):

    @Html.EditorFor(model => model.SomePropertyOfTypeLocaleBaseModel)
    

    Or if this is not the case simply:

    @Html.Partial("nameOfPartial", Model)
    

提交回复
热议问题