Rendering views without master page in MVC3

ぃ、小莉子 提交于 2019-12-01 18:49:22

问题


I have a few views on my website that i need to include on a start page. However, just using Html.Renderaction renders the master page and the whole shebang.

How would i go about just rendering the content?


回答1:


There are a few ways.

Make sure your returning PartialView from your Controller.

return PartialView("MyView");

Or you can set Layout to String.Empty or null inside the view.

@{
Layout=String.Empty;
}


来源:https://stackoverflow.com/questions/6134744/rendering-views-without-master-page-in-mvc3

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!