Questions tagged «displayattribute»

20
如何通过MVC剃刀代码获取Enum成员的显示名称属性?
我的模型中有一个名为“ Promotion”的属性,其类型是一个名为“ UserPromotion”的标志枚举。我的枚举成员的显示属性设置如下: [Flags] public enum UserPromotion { None = 0x0, [Display(Name = "Send Job Offers By Mail")] SendJobOffersByMail = 0x1, [Display(Name = "Send Job Offers By Sms")] SendJobOffersBySms = 0x2, [Display(Name = "Send Other Stuff By Sms")] SendPromotionalBySms = 0x4, [Display(Name = "Send Other Stuff By Mail")] SendPromotionalByMail = …

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.