0

I have a Layout page which has the following

@RenderSection("Style", required: false)
@RenderSection("Scripts", required: false)
@RenderBody()

My project was working just fine until a few days ago, now all the new views I create I get the following error

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

I Get the same error for RenderBody if I remove Style and Script. As I said, my old pages work just fine, the new pages I create have this error, I even replaced the whole code of an old page in a new page and still got the same error.

Mr.K
  • 1
  • 2
  • In _which_ layout do you call those `RenderSection()`s? Is it the same `_Layout.cshtml` for all views? Find the differences between the old and new views, I'd suspect them to not use the same layout. – CodeCaster Sep 13 '17 at 10:07
  • I only have one _Layout.cshtml in Shared folder, yes it's the same for all views. I have also copied the content of a working view in a new view and still got the same error !!! :((((( – Mr.K Sep 13 '17 at 10:17
  • can u post your view _Layout.cshtml and view page code ? – FakeisMe Sep 13 '17 at 10:22

1 Answers1

0

Figured it out,

I have a code at the top of the page in @{} which checked for permission, somehow that was causing this issue.

It's working find now, until next time :D

Mr.K
  • 1
  • 2