Unable to fix this issue: The following sections have been defined but not rendered for the section

时间:2015-07-28 23:45:05

标签: c# asp.net asp.net-mvc asp.net-mvc-4 razor

I know this question has been asked frequently on stackoverflow. However, the solutions I have implemented have not fixed this error.

The following sections have been defined but have not been rendered for the layout page "~/Views/Shared/_Layout.cshtml": "Scripts".

In my _Layout.cshtml page, I have the following code:

header("Location: ...")

All the views I have created are find, however, the Register.cshtml and Login.cshtml, precreated by the asp.net mvc project end with the lines:

    <footer>
      <p>&copy;</p>
    </footer>


@RenderSection("Scripts", required: false)

I have tried taking these lines out, and trying many combinations, nonetheless, the issue has not been fixed.

Any help would be greatly appreciated. :)

1 个答案:

答案 0 :(得分:2)

Note that you have different case for the first letter in the layout and in page. Section names are case sensitive, so decide on something, say:

=IF(B2="initial", "", C2-INDEX(C$1:C1, MAX(INDEX(ROW($1:1)*(B$1:B1="initial"), , ))))