This is an ASP.NET MVC 3 exception message. What it says? What should I do?
OK, I have this code:
@{ Layout = "~/_Layout.cshtml"; Page.Title = "Home"; } @section meta{ <meta name="keywords" content="" /> <meta name="description" content="" /> } <h2>Html Content Here</h2> @section footer { <script src="http://code.jquery.com/jquery-latest.min.js" charset="utf-8"></script> <script type="text/javascript"> $(document).ready(function() { }); </script> }
On your layout page, if required is set to false : @RenderSection("scripts", required: false) , when the page renders and the user is on the about page, contacts. js won't render. If required is set to true : @RenderSection("scripts", required: true) , When page renders and user is on the About page, contacts.
RenderSectionAsync(String) In layout pages, asynchronously renders the content of the section named name . RenderSectionAsync(String, Boolean) In layout pages, asynchronously renders the content of the section named name .
Your layout page isn't actually rendering the sections footer
and meta
In your _Layout.cshtml, put in @RenderSection("meta")
where you want the meta section rendered.
You can also do @RenderSection("meta", false)
to indicate that the section is optional.
The error message implies that your _Layout.cshtml
does not include @RenderSection
statements for the @section
s that you have in your view.
Check your Layout and let us know.
See this page for more information.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With