【发布时间】:2017-08-25 05:28:43
【问题描述】:
我正在尝试格式化整数并希望将其显示为 #,##0。
在 View 中,我有一个列表
<input asp-for="@Model.Application[i].abc" class="form-control input-responsive" />
所以在我的应用程序模型中,我有一个属性“abc” 我想格式化。
[Display(Name = "ABC")]
public int abc { get; set; }
最好的方法是什么。
我尝试过使用
[DisplayFormat(DataFormatString = "{0:N0}")]
但没有得到正确的结果。
【问题讨论】:
-
我试过了,它只给出零 @{ string specifier = "#,##0"; var formatted= Model.Application[i].abc.ToString(specifier); }
标签: c# html asp.net-mvc-4