added <add namespace="System.Web.Optimization" /> to view's web.config file
The following error seems to indicate that the "~/Views/Shared/_Layout.cshtml": "Scripts" requires modification.
Any input appreciated. Error follows...
The following sections have been defined but have not been rendered for the layout page "~/Views/Shared/_Layout.cshtml": "Scripts".
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: The following sections have been defined but have not been rendered for the layout page "~/Views/Shared/_Layout.cshtml": "Scripts".
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Closest thing I had to your suggestion was: @RenderBody(); I changed it to @RenderBody("scripts",
Required: false)
Perhaps I transcribed it wrong, but the result was:
Server Error in '/' Application.
--------------------------------------------------------------------------------
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS1501: No overload for method 'RenderBody' takes 2 arguments
Source Error:
Line 22: </div>
Line 23:
Line 24: @RenderBody("scripts", Required: false)
Line 25:
Line 26: <p></p>
Sorry - I'm lost here. Where would it go in the code for _Layout.cshtml (I've tried using it to replace the RenderBody() text and tried it leaving RenderBody() and pasting it at different points in the code without success)?
I was thinking that it was suppose to replace the RenderBody code at first; them I tried throwing it within the code, in addition to RenderBody, but it wasn't working for me yesterday - I probably was making some mistake that I didn't today on revisiting it.
3v3rhart
Member
159 Points
317 Posts
"~/Views/Shared/_Layout.cshtml": "Scripts" v System.Web.Optimization configuration
Nov 10, 2012 12:19 AM|LINK
installed system.web.optimization through NuGet
added <add namespace="System.Web.Optimization" /> to view's web.config file
The following error seems to indicate that the "~/Views/Shared/_Layout.cshtml": "Scripts" requires modification.
Any input appreciated. Error follows...
The following sections have been defined but have not been rendered for the layout page "~/Views/Shared/_Layout.cshtml": "Scripts".
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: The following sections have been defined but have not been rendered for the layout page "~/Views/Shared/_Layout.cshtml": "Scripts".
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[HttpException (0x80004005): The following sections have been defined but have not been rendered for the layout page "~/Views/Shared/_Layout.cshtml": "Scripts".]
System.Web.WebPages.WebPageBase.VerifyRenderedBodyOrSections() +205654
System.Web.WebPages.WebPageBase.PopContext() +318
System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +95
System.Web.WebPages.<>c__DisplayClass7.<RenderPageCore>b__6(TextWriter writer) +236
System.Web.WebPages.HelperResult.WriteTo(TextWriter writer) +12
System.Web.WebPages.WebPageBase.Write(HelperResult result) +67
System.Web.WebPages.WebPageBase.RenderSurrounding(String partialViewName, Action`1 body) +65
System.Web.WebPages.WebPageBase.PopContext() +248
System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +95
System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance) +258
System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer) +115
System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +303
System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult) +13
System.Web.Mvc.<>c__DisplayClass1a.<InvokeActionResultWithFilters>b__17() +23
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +260
System.Web.Mvc.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19() +19
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +177
System.Web.Mvc.Async.<>c__DisplayClass2a.<BeginInvokeAction>b__20() +92
System.Web.Mvc.Async.<>c__DisplayClass25.<BeginInvokeAction>b__22(IAsyncResult asyncResult) +126
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +57
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +45
System.Web.Mvc.<>c__DisplayClass1d.<BeginExecuteCore>b__18(IAsyncResult asyncResult) +14
System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +25
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +61
System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +25
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +49
System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +10
System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__3(IAsyncResult asyncResult) +28
System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +25
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +49
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8967885
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +184
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272
CPrakash82
All-Star
18712 Points
2900 Posts
Re: "~/Views/Shared/_Layout.cshtml": "Scripts" v System.Web.Optimization configuration
Nov 10, 2012 12:34 AM|LINK
Do you have something like this.
@RenderSection("scripts")
then replace it with
@RenderSection("scripts", required: false)
3v3rhart
Member
159 Points
317 Posts
Re: "~/Views/Shared/_Layout.cshtml": "Scripts" v System.Web.Optimization configuration
Nov 12, 2012 09:12 PM|LINK
Closest thing I had to your suggestion was: @RenderBody(); I changed it to @RenderBody("scripts", Required: false)
Perhaps I transcribed it wrong, but the result was:
Server Error in '/' Application.
--------------------------------------------------------------------------------
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS1501: No overload for method 'RenderBody' takes 2 arguments
Source Error:
Line 22: </div>
Line 23:
Line 24: @RenderBody("scripts", Required: false)
Line 25:
Line 26: <p></p>
Source File: c:\Documents and Settings\Alpha\My Documents\ASP MVC projects\MusicStore\Stop Points\MvcMusicStore05b\MvcMusicStore\MvcMusicStore\Views\Shared\_Layout.cshtml Line: 24
CPrakash82
All-Star
18712 Points
2900 Posts
Re: "~/Views/Shared/_Layout.cshtml": "Scripts" v System.Web.Optimization configuration
Nov 12, 2012 09:20 PM|LINK
Looks like you used the wrong one, you are using RenderBody but suggestion was to use RenderSection.
3v3rhart
Member
159 Points
317 Posts
Re: "~/Views/Shared/_Layout.cshtml": "Scripts" v System.Web.Optimization configuration
Nov 12, 2012 09:48 PM|LINK
Sorry - I'm lost here. Where would it go in the code for _Layout.cshtml (I've tried using it to replace the RenderBody() text and tried it leaving RenderBody() and pasting it at different points in the code without success)?
Thanks for your patience.
_Layout.cshtml
________________
<head>
<meta charset="utf-8" />
<title>@ViewBag.Title</title>
<link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
<script src="@Url.Content("~/Scripts/jquery-1.5.1.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/modernizr-1.7.min.js")" type="text/javascript"></script>
</head>
<body>
<div id="header">
<h1>
ASP.NET MVC MUSIC STORE</h1>
<ul id="navlist">
<li class="first"><a href="/"
id="current">Home</a></li>
<li><a
href="/Store/">Store</a></li>
</ul>
</div>
@RenderBody()
<p></p>
<p></p>
<a href= "Content\Documents\MvcMusicStore04c Models Data Access.pdf">Step by Step Instructions</a>
<p></p>
<p></p>
<h4> Notes </h4>
<p></p>
<iframe name='iframe1' id="iframe1" src=Content\Documents\notes.pdf frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 240px;"></iframe>
</body>
</html>
3v3rhart
Member
159 Points
317 Posts
Re: "~/Views/Shared/_Layout.cshtml": "Scripts" v System.Web.Optimization configuration
Nov 13, 2012 05:58 PM|LINK
Got it (it took a while, but I got it)!
I was thinking that it was suppose to replace the RenderBody code at first; them I tried throwing it within the code, in addition to RenderBody, but it wasn't working for me yesterday - I probably was making some mistake that I didn't today on revisiting it.
Thank you SO much for directing me to the answer!