I have a property for currency:
[DisplayFormat(DataFormatString = "{0:C0}")]
public long Budget { get; set; }
It is displayed in my view like this:
@Model.Budget
How can I display the numbers like this: "10 000 000 000"?
I have tried some different data format strings: {0:# #}
, {0:#,#}
and {0:N0}
, but the numbers are not affected - it just displays as "10000000000".
Solution
The problem was this:
@Model.Budget
It has to be this:
@Html.DisplayFor(model => model.Budget)