数据注释进行舍入
您好,我的一个模型中有一个属性:
[Required(ErrorMessage = "Total (Exc. GST) is a required field.")]
[Display(Name = "Total (Exc. GST):")]
[DataType(DataType.Currency)]
public virtual decimal TotalExcludingGst { get; set; }
它上面有货币注释。
问题是,当验证期间发生问题时,它会显示 4 个小数位,例如
57500.0000
是否有无论如何添加一个注释,使验证消息中的这 2 个小数位?
Hi I have a property in one of my models which is:
[Required(ErrorMessage = "Total (Exc. GST) is a required field.")]
[Display(Name = "Total (Exc. GST):")]
[DataType(DataType.Currency)]
public virtual decimal TotalExcludingGst { get; set; }
It has the currency annotation above it.
The problem is when an issue with it happened during validation it displays with 4 decimal places like
57500.0000
Is there anyway to add an annotation that will make this 2 decimal places in the validation messages?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
添加
或
Add
or