[英]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.