Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What to do with @RenderBody()?

I have an ASP.NET MVC 3 application with JQuery UI Tabs. I have a master layout page _layout.cshtml, code below. The master _layout.cshtml requires a @RenderBody() code. Since it is required, what am I supposed to do with it. I guess where I'm going with this is I do not know if I'm doing this correctly, since I'm not using it.
Should I be and what are the problem if not ?
Thanks.

 <div class="page">
        <div id="title" style=" height:120px" >                
            <img alt="Test.com" src="/Content/images/TestLogoLeft.png" style="width:370px; float:left; margin:0px;" />
        </div>

        <div id="titleRight" style=" background-color:White; width:580px; height:120px; float:right;"></div>

        <div id="menu" style=" background-color:White; width:950px; height:400px; float:left;">

            <!-- Must have class= info to prevent flash of just content on refresh -->
            <div id="tabs" class="ui-tabs ui-widget ui-widget-content ui-corner-all" style=" position:relative; border:0px;"   >
                <ul class="ui-tabs-nav">                        
                    <li><a href="#tabs-1" >Home</a></li>                        
                    <li><a href="#tabs-2" >Statistics</a></li>
                    <li><a href="#tabs-3" >Maps</a></li>
                    <li><a href="#tabs-4" >FAQs</a></li>
                    <li ><a href="#tabs-5">Login</a></li>
                    <li ><a href="#tabs-6">SignUp</a></li>
                </ul>
                <div id="tabs-1" class="ui-tabs-hide ui-tabs-panel">@Html.Partial("../Home/Home") </div>
                <div id="tabs-2" class="ui-tabs-hide ui-tabs-panel">@Html.Partial("../Statistics/Statistics")</div>
                <div id="tabs-3" class="ui-tabs-hide ui-tabs-panel">@Html.Partial("../Maps/Maps")</div>
                <div id="tabs-4" class="ui-tabs-hide ui-tabs-panel">@Html.Partial("../Home/FAQs")</div>                                     
               <div id="tabs-5" class="ui-tabs-hide ui-tabs-panel">@Html.Partial("../Account/LogOn")</div>                                                        
               <div id="tabs-6" class="ui-tabs-hide ui-tabs-panel">@Html.Partial("../Account/Register")</div> 

            </div>               
        </div>               
 </div>


 @* TODO: I need to figure out what to do with this  *@        
<div id="main" style=" display:none">
    @RenderBody()           
</div>      
like image 376
KeelRisk Avatar asked Jan 25 '11 03:01

KeelRisk


1 Answers

The @RenderBody call will render the content of your actual view.
You should put it wherever you want the view's content to be.

like image 162
SLaks Avatar answered Oct 04 '22 07:10

SLaks