title: ASP.NET MVC razor: conditional attribute in HTML
body: <p>Code below doesn't seems clean.
  Any suggestion to improve the code?</p>
  
  <pre><code>&lt;li @if(ViewData["pagename"].ToString()=="Business details"){ &lt;text&gt;class="active" &lt;/text&gt; } &gt;
          &lt;a  @if(ViewData["pagename"].ToString()=="Business details"){ &lt;text&gt;style="color: white; background-color: #08C; border: 1px solid #08C;" &lt;/text&gt; }
              href="@Url.Action("BusinessDetails", "Business")"&gt;Business Details&lt;/a&gt;
      &lt;/li&gt; 
      &lt;li @if (ViewData["pagename"].ToString() == "Booking policies"){ &lt;text&gt;class="active"&lt;/text&gt; }&gt; 
          &lt;a  @if (ViewData["pagename"].ToString() == "Booking policies")
                 { &lt;text&gt;style="color: white; background-color: #08C; border: 1px solid #08C;" &lt;/text&gt; }
              href="@Url.Action("BookingPolicies", "Business")"&gt;Booking policies&lt;/a&gt; 
      &lt;/li&gt; 
  </code></pre>