简体   繁体   中英

resolving model conflict between page and partial view in master page MVC?

I have a mvc site where the master page uses RenderPartial to return different views based on user roles. One of the partial view is inherited on a "SettingsModel" type. This results in a conflict with the underlying page which takes a different model. When it tries to render the page, it says "I'm expecting "settingsModel" but the incoming model is for the page. How can I resolve this conflict?

您可以使用RenderAction方法来呈现具有自己的视图模型的不同部分页面, 本文介绍了不同的黑白rederpartial和renderAction各自的优缺点

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM