[英]How to format decimal in c# asp-format tag to 2 decimal points and without trailing zeros if it is an int?
如何将 c# asp-format 标记中的小数格式化为 2 个小数点,如果它是 int,则不带尾随零?
<input asp-for="X" asp-format="{0:0.00}" />
我需要:
123.456 => 123.46
123.45 => 123.45
123.4 => 123.40
123 => 123
谢谢
尝试这个
asp-format =“ {0:0。##}”
asp格式是正确的。 更改格式语法。
asp-format="{0:n2}"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.