Layout does not appear in "_layout.cshtml"

1

I'm editing the _layout.cshtml file so that it can be replicated on the other pages.

However, when I run my program it's like I have not made any changes to the layout.

What can it be?

By the way, I'm having the error like this:

  

The name 'Scripts' does not exist in the current context, "this error prevents me from seeing my layout?

My layout is ugly and without any modification!

<!DOCTYPE html>
<html lang="pt-BR">
    <head>
        <meta charset="utf-8" http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
        <title>PROJECT</title>
        <link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />
        <meta name="viewport" content="width=device-width" />
        @Scripts.Render("~/bundles/modernizr")
        @Scripts.Render("~/bundles/jquery")
        @Scripts.Render("~/bundles/jqueryui")
        <script type="text/javascript" src="@Scripts.Url("~/scripts/jquery-extensions.js")" ></script>
        <script type="text/javascript" src="@Scripts.Url("~/scripts/jquery.min.js")"></script>
        <link rel="Stylesheet" href="~/Content/themes/base/jquery.ui.all.css" type="text/css" />
        @RenderSection("scripts", required: false)
        @Styles.Render("~/Content/css")

<head>
<body>
<header>
    <div id="body_principal">
        <div>
            <div id="cabecalho">
                <a href="@Url.Action("Index", "Home")">
                    <img alt="" src="@Url.Content("~/content/images/fundo_cabecalho.png")" width="200" height="100"/></a>
                <div id="vision">
                <div id="logo">
                <a href="@Url.Action("Index", "Home")">
                    <img alt="" src="@Url.Content("~/content/images/logo_header.png")" width="337" height="92" /></a>
                <div id="status">
                    <table border="0" cellspacing="0" cellpadding="0">
                        <tr><img src="@Url.Content("~/content/images/fundo_status_01.png")" width="99" height="34" /></tr>
                    </table>
                </div>
                <div>
                    @Html.Action("Switch", "Vision")
                </div>
                    <div id="user">
                        @User.Data.Name
                    </div>
                <div id="icones">
                        <img alt="@User.Data.Name" src="@Url.Content("~/Content/images/16/ico_user.gif")" align="middle" />
                    </div>
                    </div>
                    </div>
            </div>

     </header>
    <div id="conteudo">
                <div id="conteudo-principal">
                    <div id="barra-lateral">
                        <img src="@Url.Content("~/Content/images/pixel.gif")" height="1" width="1" />
                        <div id="menu_lateral">
                            @Html.Action("Menu", "Vision")
                        </div>
                    </div>
                    <div id="principal">
                        <img src="@Url.Content("~/Content/images/pixel.gif")" height="1" width="1" />
                        <div id="titulo">
                            @this.ViewBag.Title @(this.ViewBag.SubTitle == null ? string.Empty : " / ")
                            <span id="subtitulo">@this.ViewBag.SubTitle</span>
                        </div>
                        <div class="clear"></div>
                        <div id="content">@this.RenderBody()</div>
                        @RenderSection("featured", required: false)
                    </div>
                </div>
            </div>
        </div>

    <div id="console"></div>
    <script type="text/javascript" src="@Scripts.Url("~/Scripts/jquery.unobtrusive-ajax.min.js")" ></script>
</body>
</html>

    
asked by anonymous 26.11.2014 / 20:47

1 answer

1

Here is the error:

<script type="text/javascript" src="@Scripts.Url("~/Scripts/jquery.unobtrusive-ajax.min.js")" ></script>

There is no @Scripts.Url . Probably you have tried intuitively.

Simply use:

<script type="text/javascript" src="~/Scripts/jquery.unobtrusive-ajax.min.js"></script>

Another thing you need to check is whether dynamic libraries are registered in Razor. Check inside the file web.config within the Views directory (note here because there are two web.config files within the project) if there is a configuration section with the following:

  <system.web.webPages.razor>
    <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    <pages pageBaseType="System.Web.Mvc.WebViewPage">
      <namespaces>
        <add namespace="System.Web.Mvc" />
        <add namespace="System.Web.Mvc.Ajax" />
        <add namespace="System.Web.Mvc.Html" />
        <add namespace="System.Web.Optimization"/>
        <add namespace="System.Web.Routing" />
      </namespaces>
    </pages>
  </system.web.webPages.razor>
    
26.11.2014 / 22:04