samedi 5 décembre 2015

Check Positive Negative in Eval & Change color

I want to change the forecolor of a label in .aspx I tried to compare if value is > 0 then it should be Green if not then Red

the problem is in condition part I tried to use int, double, float.. but non is working I always get Specified cast is not valid.

This is my line

<asp:Label ID="TAmtLabel" runat="server" Text='<%# Eval("TAmt", "{0:c}") %>' Font-Size="13pt" Font-Bold="true" ForeColor='<%# Eval("TAmt") > 0 ? "#00C000" : "#C00000" %>' />

Aucun commentaire:

Enregistrer un commentaire