add color style to value based on condition

Posted by rod on Stack Overflow See other posts from Stack Overflow or by rod
Published on 2010-06-08T17:31:22Z Indexed on 2010/06/08 17:32 UTC
Read the original article Hit count: 269

Filed under:

Hi All,

How do I conditionally add the style 'color:red' to the .CurrentDifference if the value happens to be a negative value?

Thanks, rod.

<div class="sRow">
    <div class="sLabel p40">
        Difference:
    </div>
    <%= (!String.IsNullOrEmpty(Model.Amount)?Model.Amount.CurrentDifference.ToString("c"):string.Empty) %>
</div>

© Stack Overflow or respective owner

Related posts about jQuery