I want points and commas on milles for numbers type 'int' in function of CurrentCulture. I'm trying to use DataFormtString but its not working. For example: 1234567 ==> 123.456.789
I'm working with MVC and i want to format numbers in tables, inputs, etc.
.Replace() or something like that is not a solution, i want it in function of CurrentCulture.
For example:
[DisplayName("Test")]
[DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:N}")] // Not working
public int? Example{ get; set; }
In View:
<span class="text">@Model.Example</span>
<input asp-for="Example" class="form-control form-control-sm" />
According to your description, I have created a test demo on my side, I found the value has been set to the input, but it couldn't show because of the input type value.
I suggest you could set the input type to text and try again.
More details, you could refer to below codes:
Result: