title: How to do switch statement in aspx page with c#
body: <p>I am working on a legacy website. One of the main web application was written in C# and compiled as a dll, which basically is a black box to us. The application itself is working fine but lacks of expandability. Given enough time, we'd like to re-write the whole thing in php or python. But right now we are trying to find a workaround. </p>
  
  <p>For example, we want to replace the output  <code>&lt;%=NewKindName()%&gt;</code> into something new. I found the <a href="https://stackoverflow.com/questions/5169665/use-to-c-sharp-in-html-to-perform-if-statement">answer</a> for building an if statement in aspx, but what we really need is more likely to be a switch case statement. I know how to do that in cpp and c#, but have no idea how to insert them into asp.</p>
  
  <p>Thanks,</p>
  
  <p>==============update==========<br>
  Here's what I got:</p>
  
  <pre><code>&lt;script runat=server&gt;
  private string getSwitch(string param)
  {
  string NewNewKindName=null;
  switch (param)
      {
          case "aa":
              NewNewKindName= "AA" ;
              break;
  
          case "bb":
              NewNewKindName= "BB" ;
              break;      
          case "cc":
              NewNewKindName= "CC" ;
              break;
  
          case "dd":
              NewNewKindName= "DD" ;
              break;
          default :
              NewNewKindName= "EE" ;
              break;      
      }
      return NewNewKindName;
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>And call <code>&lt;%=getSwitch(NewKindName())%&gt;</code> in html</p>