title: How can I set a variable on a _Layout page?
body: <p>I have a view and I want to use a layout page. In the layout page I want to have a conditional banner which some of the view will turn on/off. Just wondering how I can do this?</p>
  
  <p>I have this in the _Layout.cshtml page...</p>
  
  <pre><code>@if (ShowBanner){
  
     &lt;h1&gt;banner&lt;/h1&gt;
  
  }
  </code></pre>
  
  <p>I'm wondering how I can turn this on/off from my MVC View page? Or whether this is the right thing to do at all? I mean if I declare that variable in the View page surely the master doesn't know about it? How do the two communicate through c#? Do I use the Viewbag? Rather not.</p>
  
  <p>I know with forms its all about referencing the Page or Master member, just cant quite seem to see it with MVC...</p>
  
  <p>Any help much appreciated...</p>
  
  <p>Thanks
  Pete</p>