Data Annotation for currency format not working
In my ASP.NET MVC Core web project on VS2015 , the following model is displaying data as, e.g., 15481 instead of $15,481 even though I'm using [DisplayFormat] below: Models : public class State { [Key] public int StateId { get; set; } [Column(TypeName ="varchar(40)")] public string StateName { get; set; } [Column(TypeName = "char(2)")] public string StateCode { get; set; } } public class Sales { [Key] public int SalesId { get; set; } public int? FiscalYear { get; set; } [DisplayFormat(DataFormatString = "{(0:C0)}")] public float? SaleAmount { get; set; } public int StateId { get; set; } public