Zapnologica
Zapnologica

Reputation: 22556

ASP.NET MVC @RenderBody

I have the following layout file:

 <!DOCTYPE html>
    <html>
    <head>
    <meta charset="utf-8" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Radio Manager</title>
    <link rel="stylesheet" href="Content/Template/css/style.css" type="text/css" />
    <!--[if IE 9]>
        <link rel="stylesheet" media="screen" href="Content/Template/css/ie9.css"/>
    <![endif]-->
    <!--[if IE 8]>
        <link rel="stylesheet" media="screen" href="Content/Template/css/ie8.css"/>
    <![endif]-->
    <!--[if IE 7]>
        <link rel="stylesheet" media="screen" href="Content/Template/css/ie7.css"/>
    <![endif]-->
    <script type="text/javascript" src="Content/Template/js/plugins/jquery-1.7.min.js"></script>
    <script type="text/javascript" src="Content/Template/js/plugins/jquery.flot.min.js"></script>
    <script type="text/javascript" src="Content/Template/js/plugins/jquery.flot.resize.min.js"></script>
    <script type="text/javascript" src="Content/Template/js/plugins/jquery-ui-1.8.16.custom.min.js"></script>
    <script type="text/javascript" src="Content/Template/js/custom/general.js"></script>
    <script type="text/javascript" src="Content/Template/js/custom/dashboard.js"></script>

    <!--[if lt IE 9]>
        <script src="http://css3-mediaqueries-js.googlecode.com/svn/trunk/css3-mediaqueries.js"></script>
    <![endif]-->
    <!--[if lte IE 8]><script language="javascript" type="text/javascript" src="Content/Template/js/plugins/excanvas.min.js"></script><![endif]-->
</head>
    @Html.Partial("_Header_top")

    <!-- START OF MAIN CONTENT -->
    <div class="mainwrapper">
    <div class="mainwrapperinner">
        @Html.Partial("_Menu_left")
        @RenderBody()

    </div><!--mainwrapperinner-->
</div><!--mainwrapper-->
<!-- END OF MAIN CONTENT -->

</html>

Now it is giving me the error that a div cannot be nested inside a html tag.

I think the issues is that the renderBody helper function inserts the body tags.

But I need my view to be rendered inside the two div tags. How can I do this?

Upvotes: 0

Views: 959

Answers (1)

Satpal
Satpal

Reputation: 133423

You have missed <body></body> tag. Move all markup except head under <body></body> tag

Upvotes: 3

Related Questions