title: How to make dynamic menu based on role in nested master page asp.net mvc 4?
body: <p>I want to ask about dynamic menu based on role in master page asp.net mvc 4. before i ask about it. I have database menu in sql server express 2008 like this:</p>
  
  <pre><code>Id_Menu        int          NotNull
  Displaymenu    varchar(50)  Null
  Url            varchar(50)  Null
  ParentID       int          Not Null
  </code></pre>
  
  <p>and i have created master page in mvc 4 like this :</p>
  
  <pre><code>&lt;body&gt;
      &lt;header&gt;
         &lt;div class="float-left"&gt;
                 &lt;img src="../../Images/logo.png" width="350" height="95" /&gt;
          &lt;/div&gt;
          &lt;div class="content-wrapper"&gt;
              &lt;div class="float-right"&gt;
                  &lt;section id="login"&gt;
                      &lt;%: Html.Partial("_LoginPartial") %&gt;
                  &lt;/section&gt;
                  &lt;nav&gt;
                      &lt;ul id="menu"&gt;
                          &lt;li&gt;&lt;%: Html.ActionLink("Home", "Index", "Home") %&gt;&lt;/li&gt;
                          &lt;li&gt;&lt;%: Html.ActionLink("About", "About", "Home") %&gt;&lt;/li&gt;
                          &lt;li&gt;&lt;%: Html.ActionLink("Contact", "Contact", "Home") %&gt;&lt;/li&gt;
                      &lt;/ul&gt;
                  &lt;/nav&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/header&gt;
      &lt;div id="body"&gt;
          &lt;asp:ContentPlaceHolder ID="FeaturedContent" runat="server" /&gt;
          &lt;section class="content-wrapper main-content clear-fix"&gt;
              &lt;asp:ContentPlaceHolder ID="MainContent" runat="server" /&gt;
          &lt;/section&gt;
      &lt;/div&gt;
      &lt;footer&gt;
          &lt;div class="content-wrapper"&gt;
              &lt;div class="float-left"&gt;
                  &lt;p&gt;&amp;copy; &lt;%: DateTime.Now.Year %&gt; - Cenie.Sistem Informasi.IT 
        Telkom&lt;/p&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/footer&gt;
  </code></pre>
  
  <p>and the i have created nested master page like this :</p>
  
  <pre><code>&lt;%@ Master Language="C#" MasterPageFile="~/Views/Shared/Site.Master" 
   AutoEventWireup="true" CodeBehind="Dashboard.master.cs" 
   Inherits="TA_SID.Views.Shared.Dashboard&lt;TA_SID.Models&gt;" %&gt;
  &lt;asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server"&gt;
   &lt;/asp:Content&gt;
   &lt;asp:Content ID="Content2" ContentPlaceHolderID="FeaturedContent" runat="server"&gt;
    &lt;/asp:Content&gt;
  &lt;asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server"&gt;
  &lt;div class="span3 main-menu-span"&gt;
              &lt;div class="well nav-collapse sidebar-nav"&gt;
                  &lt;ul class="nav nav-tabs nav-stacked main-menu"&gt;
                      &lt;li class="nav-header hidden-tablet"&gt;MAIN    
     MENU&lt;/li&gt;
                      if()
                      &lt;li&gt;&lt;a class="ajax-link"   
  href="/Admin/Index"&gt;&lt;i class="icon-home"&gt;&lt;/i&gt;&lt;span class="hidden-tablet"&gt; 
  Dashboard&lt;/span&gt;   
  &lt;/a&gt;&lt;/li&gt;
                      &lt;li&gt;&lt;a class="ajax-link"   
   href="/Admin/PertaminaIndex"&gt;&lt;i class="icon-eye-open"&gt;&lt;/i&gt;&lt;span class="hidden-tablet"&gt; 
  Pertamina&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
                      &lt;li&gt;&lt;a class="ajax-link"     
  href="/Admin/DistributorIndex"&gt;&lt;i class="icon-edit"&gt;&lt;/i&gt;&lt;span class="hidden-tablet"&gt; 
  Distributor&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
                      &lt;li&gt;&lt;a class="ajax-link"   
  href="/Admin/CustomerIndex"&gt;&lt;i class="icon-list-alt"&gt;&lt;/i&gt;&lt;span class="hidden-tablet"&gt;    
   Customer&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
                      &lt;li&gt;&lt;a class="ajax-link"    
   href="/Admin/ProdukIndex"&gt;&lt;i class="icon-font"&gt;&lt;/i&gt;&lt;span class="hidden-tablet"&gt;  
   Product&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
                      &lt;li&gt;&lt;a class="ajax-link" href="table.html"&gt;   
   &lt;i class="icon-align-justify"&gt;&lt;/i&gt;&lt;span class="hidden-tablet"&gt; Chart&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
                      &lt;li&gt;&lt;a class="ajax-link"   
   href="calendar.html"&gt;&lt;i class="icon-calendar"&gt;&lt;/i&gt;&lt;span class="hidden-tablet"&gt;   
   Calendar&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
                      &lt;li&gt;&lt;a class="ajax-link" href="grid.html"&gt;&lt;i  
   class="icon-th"&gt;&lt;/i&gt;&lt;span class="hidden-tablet"&gt; User&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
  
                  &lt;/ul&gt;
              &lt;/div&gt;&lt;!--/.well --&gt;
          &lt;/div&gt;
   &lt;/asp:Content&gt;
   &lt;asp:Content ID="Content4" ContentPlaceHolderID="ScriptsSection" runat="server"&gt;
   &lt;/asp:Content&gt;
  </code></pre>
  
  <p>can you help me.. How to create dynamic menu load in nested master page if i log in as admin or as user after i success log in as role? </p>
  
  <p>thank you for your help..</p>