nVelocity - Template issue when attempting 'greater than' comparison on decimal property
- by Bart
I have a simple object that has as one of it's properties a decimal named Amount. When I attempt a comparison on this property as part of an nVelocity template, the comparison always fails. If I change the property to be of type int the comparison works fine. Is there anything extra I need to add to the template for the comparison to work?
Below is a sample from the aforementioned template:
#foreach( $bet in $bets )
<li>
$bet.Date $bet.Race
#if($bet.Amount > 10)
<strong>$bet.Amount.ToString("c")</strong>
#else
$bet.Amount.ToString("c")
#end
</li>
#end
Below is the Bet class:
public class Bet
{
public Bet(decimal amount, string race, DateTime date)
{
Amount = amount;
Race = race;
Date = date;
}
public decimal Amount { get; set; }
public string Race { get; set; }
public DateTime Date { get; set; }
}
Any help would be greatly appreciated.