在MVC3无主网页渲染视图 [英] Rendering views without master page in MVC3

查看:145
本文介绍了在MVC3无主网页渲染视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有我需要包括启动页面上我的网站一些看法。然而,仅仅使用Html.Renderaction呈现母版页和整个家当。

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?

推荐答案

有几种方法。

请确保您从您的控制器返回PartialView。

Make sure your returning PartialView from your Controller.

返回PartialView(MyView的);

或者你也可以设置布局的String.Empty或空的看法中。

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

@{
Layout=String.Empty;
}

这篇关于在MVC3无主网页渲染视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆