【发布时间】:2014-05-22 01:45:18
【问题描述】:
是否有任何方法可以自定义数据注释,就像在模型中添加 [Uppercase],[Lowercase],[ProperCase] 注释以在上述情况下转换模型。??? 我尝试过使用modelbinder,它只设置一个数据注释我想要实现的是拥有这样的模型:
[Display(Name="Agent Code", Prompt = "Agent Code")]
[CustomAttributes(Case="Uppecase", IsTrim=false)]
[Required(AllowEmptyStrings = false, ErrorMessage = ModelConstants.L_MSG_REQUIRED)]
[StringLength(10)]
public string agent_cd { get; set; }
任何想法或建议如何实现我想要的输出??
【问题讨论】:
标签: asp.net-mvc data-annotations