Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我试图从这个表达式(ProductPrice * x)中倍增值:
@Html.DisplayFor(model => model.ProductPrice)
最干净的方法是在模型中拥有另一个属性,例如TotalPrice:
TotalPrice
public decimal TotalPrice { get { return ProductPrice * x; } }
然后做:
@Html.DisplayFor(model => model.TotalPrice)
@Html.DisplayFor(model => (model.ProductPrice * x))