我如何“渲染”我的MVC4项目中的正确部分? [英] How do I "render" the correct sections in my MVC4 project?

查看:66
本文介绍了我如何“渲染”我的MVC4项目中的正确部分?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的MVC4项目中,我收到以下错误。我在_Layout.cshtml中找不到任何说精选的内容。



如何渲染正确的部分?

In my MVC4 project I am getting the below error. I can not find anything that says "featured" in my "_Layout.cshtml".

How do I "render" the correct sections?

The following sections have been defined but have not been rendered for the layout page "~/Views/Shared/_Layout.cshtml": "featured". 

推荐答案

您的视图似乎在某处定义了@section featured,并尝试将输出提供给名为feature的部分[这是未在您的布局页面中定义]。



因此解决方案可以是以下之一



1.从您的视图中删除包含 @section精选







2.添加@RenderSection(精选,必填:false )进入你的布局页面
Your view seems to have "@section featured" defined somewhere, and that tries to give output to section called feature[Which is not defined in your layout page].

So solution can be one of the following

1. Remove section from your view which contains "@section featured"

OR

2. Add @RenderSection("featured", required: false) into your layout page


这篇关于我如何“渲染”我的MVC4项目中的正确部分?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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