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.
如何显示具有 3 个小数位的模型小数字段。目前它将其缩短为 2 位数。
1,237 当前将显示为 1,24 ;)
您可以在视图模型上使用数据注释,如下所示:
[DisplayFormat(DataFormatString = "{0:0.00}", ApplyFormatInEditMode = true)] public decimal Num { get; set; }