我想格式化一个整数并希望将其显示为#,## 0。使用逗号格式化整数并用逗号显示值
看来,我有一个列表
<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); } – Tina