title: MVC - Nested Partial Views
body: <p>I am getting an error ("<em>Server Error in '/' Application</em>") when I nest partial views in my <code>MVC</code> app.  The views work fine individually, but not when nested.  It's my understanding that it's okay to do this, so what am I doing wrong?</p>
  
  <p>Essentially, I am trying to use partials as sub-layouts within my <code>_Layout.cshtml</code>.</p>
  
  <p>Here's my main layout - <code>_Layout.cshtml</code></p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;...&lt;/head&gt;
  &lt;body style="padding-top: 80px;"&gt;  
      &lt;div class="container-fluid"&gt;
          &lt;div class="row"&gt;
              &lt;div id="myTab" class="col-lg-12 col-md-12 col-sm-12"&gt;
                  ...
                  &lt;div class="tab-content"&gt;
                      &lt;div class="tab-pane fade" id="search"&gt;
                         @Html.Partial("~/Areas/Search/Views/Shared/_SearchLayout.cshtml")
                      &lt;/div&gt;                   
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
      @RenderBody()
      @RenderSection("scripts", required: false)
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>This is the first partial view (_SearchLayout).  If I remove the partials AND @RenderBody, no error.</p>
  
  <pre><code>&lt;div class="container-fluid"&gt;
          @Html.Partial("_PolicySearch")
          @Html.Partial("_ClaimSearch")       
      &lt;/div&gt;
  @RenderBody()
  </code></pre>
  
  <p>This partial view is nested in the first partial view (_SearchLayout):</p>
  
  <pre><code> &lt;div class="row top-buffer search-outline form-horizontal"&gt;
          &lt;div class="col-md-1 search-icon-size text-primary"&gt;
              &lt;i class="glyphicon glyphicon-heart"&gt;&lt;/i&gt;
          &lt;/div&gt;
          &lt;div class="col-md-1 search-icon-size text-primary"&gt;
              &lt;h4&gt;Claim Search&lt;/h4&gt;
          &lt;/div&gt;    
      &lt;/div&gt;
  </code></pre>