Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我的网站上有一些视图需要包含在起始页中。但是,仅使用 Html.Renderaction 会呈现母版页和整个 shebang。
我将如何去渲染内容?
有几种方法。
确保从控制器返回 PartialView。
return PartialView("MyView");
或者,您可以在视图内将 Layout 设置为 String.Empty 或 null。
@{ Layout=String.Empty; }