title: ASP.net label control data bind color change
body: <p>I am trying to figure out a way to change the color of the text display in a label control or span inside a user control.</p>
  
  <p>The text needs to be displayed in a different colour based on the value returned.</p>
  
  <pre><code>&lt;asp:Label ID="NameLabel" runat="server" Text='&lt;%# Eval("Name").ToString()=="Flying Bats" ? "Display the text in green" : "Display the text in red" %&gt; '/&gt;
  </code></pre>
  
  <p>The text value would be one of the two. The font color needs to be ether red or green based on whats been returned.</p>
  
  <p>I cannot figure out how to do it. Any hints would be appreciated.</p>