已经定义了以下部分,但尚未为布局页面呈现 [英] The following sections have been defined but have not been rendered for the layout page

查看:625
本文介绍了已经定义了以下部分,但尚未为布局页面呈现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是一个ASP.NET MVC 3异常消息。说什么我应该怎么办?



确定,我有这个代码:

  @ {
Layout =〜/ _Layout.cshtml;
Page.Title =Home;
}

@section meta {
< meta name =keywordscontent =/>
< meta name =descriptioncontent =/>
}

< h2> Html内容此处< / h2>

@section footer {
< script src =http://code.jquery.com/jquery-latest.min.jscharset =utf-8>< ; /脚本>
< script type =text / javascript>
$(document).ready(function(){
});
< / script>
}


解决方案

您的布局页面不是实际上呈现了 footer



_Layout.cshtml,放在 @RenderSection(meta)中,您希望元部分呈现。



您还可以执行 @RenderSection(meta,false)来表示该部分是可选的。 / p>

This is an ASP.NET MVC 3 exception message. What it says? What should I do?

OK, I have this code:

@{
     Layout = "~/_Layout.cshtml";
     Page.Title = "Home";            
}

@section meta{
    <meta name="keywords" content="" />
    <meta name="description" content="" />
}

<h2>Html Content Here</h2>

@section footer {
    <script src="http://code.jquery.com/jquery-latest.min.js" charset="utf-8"></script>
    <script type="text/javascript">
        $(document).ready(function() {
    });    
    </script> 
}

解决方案

Your layout page isn't actually rendering the sections footer and meta

In your _Layout.cshtml, put in @RenderSection("meta") where you want the meta section rendered.

You can also do @RenderSection("meta", false) to indicate that the section is optional.

这篇关于已经定义了以下部分,但尚未为布局页面呈现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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