title: How to do conditional markup in shared view (_Layout.cshtml)
body: <p>I have a pure CSS dropdown menu that I've put in a shared view, so that no matter where user navigates to the menu is available. I want to determine the visibility of menu items according to user role. Something like this (Just a fragment of razor):</p>
  
  <pre><code>&lt;ul&gt;
  @if(userRole==1||userRole==2)
     &lt;li&gt;&lt;a href="#"&gt;Submenu1&lt;/a&gt;&lt;/li&gt;
  </code></pre>
  
  <p>But I have no idea how to do it as :</p>
  
  <p><s>1. I have no access to ViewBag, otherwise I could just set the user role in ViewBag and read it</s></p>
  
  <ol start="2">
  <li>I cannot strongly type the shared view to some model.</li>
  </ol>
  
  <p>What are your suggestions?</p>
  
  <p>EDIT: Actually you can set and access ViewBag. that solves the problem.</p>