MVC @RenderSection “sections have been defined but have not been rendered” scripts. When multiple levels of page

You’ll need to redefine the section in _MainPage.cshtml.

_BootstrapLayout.cshtml

@RenderSection("scripts", false)

_MainPage.cshtml

@section scripts
{
   @RenderSection("scripts", false)
}

Index.cshtml

@section scripts
{
   <script>
     // etc.
   </script>
}

Leave a Comment