title: ASP.NET MVC How to use PartialView in Layout?
body: <p>I need to render menu in Layout by using partial view (if there is better approach, please let me know). I'm doing it this way (in Layout):</p>
  
  <pre><code> @if (User.IsInRole("Admin"))
     {
        @Html.Partial("AdminMenu")
     }
  </code></pre>
  
  <p>And this how I call this in Controller:</p>
  
  <pre><code>public ActionResult AdminMenu()
    {
        var am = _amr.GetAdminMenu();
        return PartialView(am);
    }
  </code></pre>
  
  <p>So here is my partial view:</p>
  
  <pre><code>@model IEnumerable&lt;DigitalHubOnlineStore.ViewModels.AdminMenuViewModel&gt;
  
  &lt;div class="dropdown"&gt;
      &lt;button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true"&gt;
          Admin menu
          &lt;span class="caret"&gt;&lt;/span&gt;
      &lt;/button&gt;
      &lt;ul class="dropdown-menu" aria-labelledby="dropdownMenu1"&gt;
          @foreach (var item in Model)
          {
              &lt;li&gt;&lt;a href="@Html.DisplayFor(modelItem =&gt; item.MenuItemUrl)"&gt;@Html.DisplayFor(modelItem =&gt; item.MenuItemName)&lt;/a&gt;&lt;/li&gt;
          }
      &lt;/ul&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Unfortunately it's not working.</p>