I have a decimal value for example: 59625879,00
I want to show this value like this: 59.625,879 or 59625,879
How can I do this with @Html.DisplayFor(x => x.TAll, String.Format()) ?
Thanks.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Decorate your view model property with the
[DisplayFormat]attribute and specify the desired format:and then in your view:
Another possibility if you don’t want to do this on the view model you could also do it inside the view:
but I would recommend you the first approach.
Yet another possibility is to write a custom display template for the decimal type (
~/Views/Shared/DisplayTemplates/MyDecimalTemplate.cshtml):and then: