Apply the DisplayFormat attribute to the model property:
[DisplayFormat(DataFormatString = "{0:N2}")] public decimal Cost { get; set; }
Formatting is then done using ModelBinder for you, not so that you can remember it in each individual view.
source share