In my aspx page, I need to have negative numbers appear in red, and positive numbers appear in blue.
Below is the code I have written so so far. Basically I need help with my Eval statement, as the code does not appear to work ast this time. Can someone help my out?
// Aspx page
<td style="<%# Eval("Amount",GetStuff(Container.DataItem)) == "-" ? Response.Write("color : red") : Response.Write("blue") %>"> </td>
// C# page
protected string GetStuff(Container.DataItem)
{
string number = DataBinder.Eval(dataItem.ToString(),"{0:c}").ToString();
int number = Int32.Parse(number); if(number > 0) { return "+" } else return "-"
}
Go to the complete details ...