KnockoutMVC 2.10, MVC 4.0, C# 5.
Working from one of the examples on the main site (Computed fields in Sub Models). I am having a problem and wondered if anyone could help. In the code below, the computed Message field updates fine, based on two text boxes associated with Caption and Value respectively. However, as soon as I un-comment the second [Computed] attribute, with no other changes to the View (or any other code), it stops working. Incidentally, in the same project, in the main model I have tried 2 computed fields and they worked fine. Is this a limitation of sub models (ie only one computed field allowed)?
Thanks Rob
public class InnerComputedSubModel
{
public decimal Caption { get; set; }
public decimal Value { get; set; }
public decimal Caption2 { get; set; }
public decimal Value2 { get; set; }
[Computed]
public decimal Message
{
get { return Caption * Value; }
}
//[Computed]
public decimal Message2
{
get { return Caption2 * Value2 * 20; }
}
}
public class InnerComputedModel
{
public InnerComputedSubModel SubModel { get; set; }
}