title: Conditional render in asp.net
body: <p>How can I get something like this to work in asp.net</p>
  
  <pre><code>&lt;asp:Panel Visible="&lt;%(SType==switch_type.Trunk).ToString()%&gt;" runat="server"&gt;Tickle&lt;/asp:Panel&gt;
  </code></pre>
  
  <p>Where switch_type is an enum of values and SType is a get/set in the codebehind.</p>
  
  <p>I have this working, but I just feel it is ugly </p>
  
  <pre><code>&lt;% if (SType == switch_type.Trunk)
      { %&gt;
          ...
  </code></pre>
  
  <p>I know I can set the panel as visible/invisible in the codebehind, but there are going to be a lot of panels and it just seems easier to set the visibility in the aspx file.</p>