title: hide or disable MultiView Tabs from C# code behind?
body: <p>I am using a multiview control for the first time to display various tools when clicking on tabbed menu items.</p>
  
  <p>I am suprised by my searches this is not really possible using Asp.net / C# code-behind alone?</p>
  
  <p>How do you disable a Tab in code behind if for example the Session value for UserName is not a match?</p>
  
  <p>This is a C# web application.</p>
  
  <pre><code>&lt;asp:MultiView ID="ToolsMultiView" runat="server" ActiveViewIndex="0"&gt;
  &lt;asp:View ID="Tab1" runat="server"&gt;
      &lt;div class="row"&gt;
          lots more code..
      &lt;/div&gt;
  &lt;/asp:View&gt;
  &lt;asp:View ID="Tab2" runat="server"&gt;
      &lt;div class="row"&gt;
          lots more code..
      &lt;/div&gt;
  &lt;/asp:View&gt;
  &lt;asp:View ID="Tab3" runat="server"&gt;
      &lt;div class="row"&gt;
          lots more code..
      &lt;/div&gt;
  &lt;/asp:View&gt;
  </code></pre>
  
  <p></p>
  
  <p>I also found I was not allowed to add conditional code on the .aspx page to skip an asp:View section.</p>
  
  <p>Parser Error Message: A rendering block cannot be nested inside a MultiView control.</p>
  
  <pre><code>Line 171:            &lt;div class="viewWrapper"&gt;
  Line 172:                &lt;asp:MultiView ID="ToolsMultiView" runat="server" ActiveViewIndex="0"&gt;
  Line 173:                &lt;%if (1 = 1) { %&gt;
  Line 174:                    &lt;asp:View ID="Tab1" runat="server"&gt;
  Line 175:                        &lt;div class="row "&gt;
  </code></pre>