title: MVC4 Using nested @Html.RenderPartial() throws Compiler Error Message: CS1502
body: <p>I am using MVC 4 and wanted to tidy up my views a bit so decided to create multiple partial views and bring them together during the rendering.</p>
  
  <p>this works when the view being rendered has few  <code>@Html.RenderPartial('path\to\my\partialView.cshtml')</code> but fails if this partialView.cshtml is in turn has further <code>@Html.RenderPartial('path\to\my\otherPartialView.cshtml')</code> defined inside it.</p>
  
  <p>i get errors like with using either RenderPartial or Partial method </p>
  
  <pre><code>error CS1502: The best overloaded method match for 'System.Web.WebPages.WebPageExecutingBase.Write(System.Web.WebPages.HelperResult)' has some invalid arguments
  error CS1503: Argument 1: cannot convert from 'void' to 'System.Web.WebPages.HelperResult'
  </code></pre>
  
  <p>Is there a way in MVC4 we can achieve to tidy up my large view markup files? i.e. try to progressively compose the partial views with other partial views.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Just to give more details. </p>
  
  <p>My Mobile view looks like this:</p>
  
  <p>File : ManageLoads.Mobile.cshtml </p>
  
  <p>Location: Views->Shipper->ManageLoads</p>
  
  <p>inside this view I have code like this:</p>
  
  <pre><code>&lt;div id="landingPage" ng-show="MenuSelection=='DefaultPage'"&gt;
              @Html.Partial("~/Views/Shipper/_DashboardPartial.cshtml")
              &lt;div class='message {{MessageClass}}'&gt;
                  &lt;i class='{{MessageIcon}}'&gt;&lt;/i&gt;
                  &lt;p&gt;{{Message}}&lt;/p&gt;
              &lt;/div&gt;
          &lt;/div&gt;
  </code></pre>
  
  <p>this part works fine without issue. now inside the _DashboardPartial.cshtml if I have reference to another partial view, it fails.</p>
  
  <pre><code>&lt;div id="warehouseSelection" ng-show="getStep()==1"&gt;
     {@Html.RenderPartial("~/Views/Shipper/mobilePartials/_MyWarehouse.cshtml");}
  &lt;/div&gt;
  </code></pre>
  
  <p>this breaks and throws error, but if I copy paste the content of the "_MyWarehouse.cshtml" inside there, it starts to work again. I have verified that the path to the _MyWarehouse.cshtml is correct, so i suspected it has something to do with the nesting of the RenderPartial method that is causing the issue.</p>
  
  <p>Regards
  Kiran</p>