title: changing css class from code behind variable - way to avoid?
body: <p>I need to change the background of a div based on some count property set in the code behind. I can get it to work as below. But i'm wondering if this is a good practice. If I need to change the count logic, I have to update code vs html. I suppose Jquery can't do this unless I have a hidden variable with count on the page. Is this better than writing an If loop logic within the html?</p>
  
  <p><strong>html</strong></p>
  
  <pre><code>&lt;div class="show &lt;%=CSSClass %&gt;"&gt;  value &lt;/div&gt;
  </code></pre>
  
  <p><strong>code behind</strong> </p>
  
  <pre><code>public string CSSClass
              {
                  get
                  {
                      if (count &gt; 1) return "bright";
  
                      else if (count == 0)
                          return "normal";
  
                      return "dim";
                  }
              }
  </code></pre>