How to format decimal in c# asp-format tag to 2 decimal points and without trailing zeros if it is an int?
<input asp-for="X" asp-format="{0:0.00}" />
I need:
123.456 => 123.46
123.45 => 123.45
123.4 => 123.40
123 => 123
thanks
Try this
asp-format="{0:0.##}"
asp-format is correct. Change the format syntax.
asp-format="{0:n2}"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.