title: MVC: How to get controller to render partial view initiated from the view
body: <p>In my MVC5 project I want to create a menu in a partial view. This menu is dynamic in the sense that it is built from content in my database. Thus I have a controller taking care of creating my menu and returning the menu model to my partial view:</p>
  
  <pre><code>public PartialViewResult GetMenu()
  {
     MenuStructuredModel menuStructuredModel = menuBusiness.GetStructuredMenu();
  
     return PartialView("~/Views/Shared/MenuPartial", menuStructuredModel);
  }
  </code></pre>
  
  <p>In my partial view called <em>MenuPartial</em> I want to use razor to iterate over my menu items, like:</p>
  
  <pre><code>@model MyApp.Models.Menu.MenuStructuredModel
  
  &lt;div class="list-group panel"&gt;
      @foreach (var category in Model.ViewTypes[0].Categories)
      {
          &lt;a href="#" class="list-group-item lg-green" data-parent="#MainMenu"&gt;@category.ShownName&lt;/a&gt;
      }
  &lt;/div&gt;
  </code></pre>
  
  <p>Now the problem is the view in which I insert the partial view. If in the view I simply do:</p>
  
  <pre><code>@Html.Partial("MenuPartial")
  </code></pre>
  
  <p>It won't call the controller to populate the model with data first. What I want is to let the controller return the partial. But I don't know how to do this from the view. In pseudo code I would like to do something like:</p>
  
  <pre><code>@Html.RenderPartialFromController("/MyController/GetMenu")
  </code></pre>