使用的Razor视图引擎MVC 3,从局部视图渲染节 [英] Rendering section from partial view using Razor View engine in MVC 3

查看:162
本文介绍了使用的Razor视图引擎MVC 3,从局部视图渲染节的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经呈现在底部总纲的部分。这通常是部分在页面底部呈现JavaScript时,它呈现。在定义查看和_partial观点,即部分。当页面呈现,它呈现在网页视图部分而不是从_partial视图。

I have rendering a section in the bottom master layout. This is typically section to render javascript at the bottom of the page when it renders. Defining that section in View and _partial views. When page renders, it renders section from page view but not from the _partial view.

如何有可能呈现在_partial视图定义为主要布局的截面

How it is possible to render a section defined in _partial view to main layout?

推荐答案

您可以使用 Html.RenderAction / Html.Action 或使用助手喜欢这里证明: http://stackoverflow.com/a/5433722/290343

You can use Html.RenderAction/Html.Action or use helpers like demonstrated here: http://stackoverflow.com/a/5433722/290343

这篇关于使用的Razor视图引擎MVC 3,从局部视图渲染节的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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