伙计们。我想问一下是否有任何方法可以对货币格式进行 int 输入?我试过使用
[DisplayFormat(DataFormatString = "{0:C}", ApplyFormatInEditMode = true)]
public int TotalAmount { get; set; }
但是,它会显示一个空的
@Html.EditorFor
如果我用
[DisplayFormat(DataFormatString = "{0:F2}", ApplyFormatInEditMode = true)]
public int TotalAmount { get; set; }
它只会显示 0.00
我想要的是当我输入 10000 时,它会自动格式化为
RP。10.000
在 @Html.EditorFor 字段内。
有什么建议么?