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

后端 未结 1 868
既然无缘
既然无缘 2021-02-11 14:17

I am working with MVC v4.
I have a \'_BootstrapLayout\' page which defines all the twitter bootstrap etc stuff, A main page which defines the site layout, navbar etc, and

相关标签:
1条回答
  • 2021-02-11 14:55

    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>
    }
    
    0 讨论(0)
提交回复
热议问题