title: The following sections have been defined but have not been rendered for the layout page "~/Views/Shared/SiteLayout.cshtml": "Scripts"
body: <p>I have a simple view:</p>
  
  <pre><code>@model BootstrapTest4.Models.Account.CambioDeClave
  
  @{
      Layout = "~/Views/Shared/SiteLayout.cshtml";
  }
  
  &lt;h2&gt;@Model.Title&lt;/h2&gt;
  
  @using (Html.BeginForm()) {
      @Html.AntiForgeryToken()
      @Html.ValidationSummary(true)
  
      &lt;fieldset&gt;
  
          &lt;div class="editor-label"&gt;
              @Html.LabelFor(model =&gt; model.Pass1)
          &lt;/div&gt;
          &lt;div class="editor-field"&gt;
              @Html.EditorFor(model =&gt; model.Pass1)
              @Html.ValidationMessageFor(model =&gt; model.Pass1)
          &lt;/div&gt;
  
          &lt;div class="editor-label"&gt;
              @Html.LabelFor(model =&gt; model.Pass2)
          &lt;/div&gt;
          &lt;div class="editor-field"&gt;
              @Html.EditorFor(model =&gt; model.Pass2)
              @Html.ValidationMessageFor(model =&gt; model.Pass2)
          &lt;/div&gt;
  
          &lt;p&gt;
              &lt;input type="submit" value="Cambiar Clave" /&gt;
          &lt;/p&gt;
      &lt;/fieldset&gt;
  }
  
  @section Scripts {
      @System.Web.Optimization.Scripts.Render("~/bundles/jqueryval")
  }
  </code></pre>
  
  <p>this view was made via the <strong>Mvc4</strong> scaffolding system (edit template) and since I use some dataannotations in my model it uses the Scripts Bundle.</p>
  
  <p>the error I am getting is the following:
  The following sections have been defined but have not been rendered for the layout page "~/Views/Shared/SiteLayout.cshtml": "Scripts"</p>
  
  <p>searching I found that most people solve the problem adding this to their layout:</p>
  
  <pre><code>    @if (IsSectionDefined("Scripts"))
  {
      RenderSection("Scripts",false);
  }
  </code></pre>
  
  <p>I added that block just before the  tag of my layout but i still get the same error.</p>
  
  <p>as requested: my whole Layout:</p>
  
  <pre><code>@model BootstrapTest4.Models.IMenu
  @using BootstrapTest4.Utils.Helpers
  @using BootstrapTest4.Utils
  @{
      Layout = null;
  }
  
      &lt;!DOCTYPE html&gt;
  
  
      @{
          Model.usr = (UsuarioWebCliente)Session["DatosUsr"];
          Model.usrDrogSelec = Html.DrogSeleccionada(Model.usr);
          var Lista = Html.GeneraComboDrogs2(Model.usr, Model.usrDrogSelec.cod_drogueria);
      }
      &lt;html&gt;
      &lt;head&gt;
          &lt;meta name="viewport" content="width=device-width" /&gt;
          &lt;title&gt;@ViewBag.Title&lt;/title&gt;
          &lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&gt;
          &lt;script src="~/Scripts/jquery-1.9.1.js"&gt;&lt;/script&gt;
          &lt;script src="~/Scripts/bootstrap.js"&gt;&lt;/script&gt;
          &lt;!-- Bootstrap --&gt;
          &lt;link href="~/Content/bootstrap/bootstrap.css" rel="stylesheet" media="screen"&gt;
      &lt;/head&gt;
      &lt;body style="height: 100%;  "&gt;
          &lt;div class="wrapper"&gt;
              &lt;div&gt;
                  &lt;div id="whitebar"&gt;
                      &lt;div class="container"&gt;
                          &lt;div class="row"&gt;
                              &lt;div class="col-md-6"&gt;
  
                              &lt;/div&gt;
                              &lt;div class="col-md-6" style="text-align: right"&gt;
                                  @Model.usr.DatUsrs.desc_usuario - @Model.usr.DatUsrs.codigo_ident - @Html.ActionLink("Cerrar Sesion","Logout","Account")
                              &lt;/div&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
                  &lt;div id="bluebar"&gt;
                      &lt;div class="container"&gt;
                          &lt;div class="row"&gt;
                              &lt;div class="col-md-4"&gt;
                                  @Html.DropDownListFor(x =&gt; x.usr.DatUsrs.cod_drogueria, new SelectList(Lista, "Value", "Text"), new { @id = "DDLMENU", data_url = Url.Action("CambiarDrog", "Menu") })
                              &lt;/div&gt;
                              &lt;div class="col-md-3"&gt;
                                  Monto Consumido:
                                  &lt;label id="SALDO"&gt;
                                      @(Model.usrDrogSelec.saldo_actual == 0 ? "0.00" : Convert.ToDecimal(Model.usrDrogSelec.saldo_actual).ToString("#,##.00"))
                                  &lt;/label&gt;
  
                              &lt;/div&gt;
                              &lt;div class="col-md-3"&gt;
                                  Hora Corte: XXXXX
                              &lt;/div&gt;
                              &lt;div class="col-md-2"&gt;
                                  Día Corte:
                                  &lt;label id="DIA"&gt;
                                      @Model.usrDrogSelec.dia_corte
                                  &lt;/label&gt;
  
                              &lt;/div&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
                  &lt;nav class="navbar navbar-default" role="navigation"&gt;
                      &lt;!-- Brand and toggle get grouped for better mobile display --&gt;
                      &lt;div class="navbar-header"&gt;
                          &lt;button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse"&gt;
                              &lt;span class="sr-only"&gt;Toggle navigation&lt;/span&gt;
                              &lt;span class="icon-bar"&gt;&lt;/span&gt;
                              &lt;span class="icon-bar"&gt;&lt;/span&gt;
                              &lt;span class="icon-bar"&gt;&lt;/span&gt;
                          &lt;/button&gt;
                          &lt;a class="navbar-brand" href="#"&gt;
                              &lt;img style="max-height: 20px;" src="~/Content/Images/1381797224_home.png" /&gt;
                          &lt;/a&gt;
                      &lt;/div&gt;
                      &lt;div class="collapse navbar-collapse navbar-ex1-collapse"&gt;
                          &lt;ul class="nav navbar-nav"&gt;
                              @foreach (var item in Model.MenuCollection)
                              {
                                  &lt;li class="dropdown"&gt;
                                      &lt;a href="#" class="dropdown-toggle" data-toggle="dropdown"&gt;@item.Name &lt;b class="caret"&gt;&lt;/b&gt;&lt;/a&gt;
                                      @if (item.Children.Count &gt; 0)
                                      {
                                          &lt;ul class="dropdown-menu"&gt;
                                              @foreach (var childItem in item.Children)
                                              {
                                                  &lt;li&gt;@Html.ActionLink(childItem.Name, childItem.Action, childItem.Controller)&lt;/li&gt;
                                              }
                                          &lt;/ul&gt;
                                      }
                                  &lt;/li&gt;
                              }
                          &lt;/ul&gt;
                          &lt;ul class="nav navbar-nav navbar-right"&gt;
                              &lt;li class="dropdown"&gt;
                                  &lt;a href="#" class="dropdown-toggle" data-toggle="dropdown"&gt;&lt;span class="glyphicon glyphicon-cog"&gt;&lt;/span&gt;&lt;b class="caret"&gt;&lt;/b&gt;&lt;/a&gt;
                                  &lt;ul class="dropdown-menu"&gt;
                                      &lt;li&gt;@Html.ActionLink("Droguería Principal","PrioridadDrogueria","ReportesPrioridadDrogueria")&lt;/li&gt;
                                      &lt;li&gt;&lt;a href="#"&gt;Mensajería&lt;/a&gt; &lt;/li&gt;
                                      &lt;li&gt; @Html.ActionLink("Cambio de Clave", "CambiarClave", "Account")&lt;/li&gt;
                                      &lt;li&gt;&lt;a href="#"&gt;Actualizar Datos&lt;/a&gt;&lt;/li&gt;
                                  &lt;/ul&gt;
                              &lt;/li&gt;
                          &lt;/ul&gt;
  
                      &lt;/div&gt;
                      &lt;!-- /.navbar-collapse --&gt;
                  &lt;/nav&gt;
                  &lt;div id="Content" style="height: 100%; "&gt;
                      @RenderBody()
                  &lt;/div&gt;
              &lt;/div&gt;
              &lt;div class="push"&gt;&lt;/div&gt;
          &lt;/div&gt;
          &lt;div class="footer"&gt;
              &lt;div class="row"&gt;
                  &lt;div class="col-md-12 footer"&gt;Test&lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
          @if (IsSectionDefined("Scripts"))
      {
          RenderSection("Scripts",false);
      }
      &lt;/body&gt;
      &lt;/html&gt;
  </code></pre>