gpt4 book ai didi

c# - RenderSection() inside partial with master page

转载 作者:IT王子 更新时间:2023-10-29 04:12:50 27 4
gpt4 key购买 nike

我在母版页(布局)中添加了一个部分“侧边栏”,在这个部分中我正在使用:

@RenderSection("SearchList", required: false)

在其中一个使用母版页的 View 上:

@section SearchList {
// bunch of html
}

但它给了我错误:

The file "~/Views/Shared/_SideBar.cshtml" cannot be requested directly because it calls the "IsSectionDefined" method.

这里有什么问题吗?

最佳答案

Razor 当前不支持您尝试执行的操作。部分仅在 View 页面及其直接布局页面之间起作用。

关于c# - RenderSection() inside partial with master page,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4844576/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com