[英]DataFormatString = "{0:N}" not working on Model MVC
對於 CurrentCulture 函數中的數字類型“int”,我想要在 Milles 上使用點和逗號。 我正在嘗試使用 DataFormtString 但它不起作用。 例如:1234567 ==> 123.456.789
我正在使用 MVC,我想格式化表格、輸入等中的數字。
.Replace() 或類似的東西不是解決方案,我希望它具有 CurrentCulture 的功能。
例如:
[DisplayName("Test")]
[DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:N}")] // Not working
public int? Example{ get; set; }
在視圖中:
<span class="text">@Model.Example</span>
<input asp-for="Example" class="form-control form-control-sm" />
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.