I have an ASP .NET MVC3 (razor) site following this structure:
Site1
-Areas
-Area1
-Views
-SomeFeature
-Index.cshtml --> sets the section 'pageScripts'
-Shared
-_Layout.cshtml --> has Layout = ~/Views/Shared_Layout.cshtml, sets the section 'layoutScripts'
-Viewstart.cshtml ---> has Layout = ~/Areas/Area1/Views/Shared/_Layout.cshtml
-Area2
-Views
-Shared
-Views
-Shared
-_Layout.cshtml ---> has optional sections pageScripts, layoutScripts
Here's my problem:
When I try to access the equivalient controller method for ~/Area1/SomeFeature/Index
, I get an exception message saying
The following sections have been defined but have not been rendered for the layout page "~/Areas/Area1/Views/Shared/_Layout.cshtml": "pageScripts".
I have the section "pageScripts" defined as
@RenderSection("pageScripts", false) in ~/Views/Shared_Layout.cshtml
Why I'm trying to do this:
At the moment, I find myself having to set the Layout property in each view in Area1 (and Area2) to ~/Views/Shared/_Layout.cshtml
Does any one know what I'm doing wrong?
-Thanks for any suggestions