DisplayFormat
特性用于显式指定日期格式:
[DisplayFormat(DataFormatString = "{0:yyyy-MM-dd}", ApplyFormatInEditMode = true)] public DateTime ReleaseDate { get; set; }
System.ComponentModel.DataAnnotations
命名空间还提供格式特性
[Display(Name = "Release Date")] [DataType(DataType.Date)] public DateTime ReleaseDate { get; set; } [Range(1, 100)] [DataType(DataType.Currency)] [Column(TypeName = "decimal(18, 2)")] public decimal Price { get; set; }
标签:set,decimal,get,DataType,模型,特性,public From: https://www.cnblogs.com/friend/p/17109307.html