您可以在局部视图中使用@section吗? [英] Can you use @section in a partial view?

查看:78
本文介绍了您可以在局部视图中使用@section吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在部分视图中使用@section,以便仅将其包含在一个文件中.这会工作吗?这种方法似乎没有渲染任何东西.

I'm trying to use the @section within a partial view so that what is included is only in one file. Will this work? This approach doesn't seem to render anything.

推荐答案

否.它不起作用.您必须在基本的.cshtml页面中使用它.

No. It doesn't work. You have to use it in the base .cshtml page.

这篇关于您可以在局部视图中使用@section吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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