Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否可以使用 Dataannotations 指定字段显示为标题大小写而不是全部大写?
如果要更改特定字段的显示名称,只需将[DisplayName("DisplayedName")]数据注释添加到模型中的属性即可。
[DisplayName("DisplayedName")]
例如,如果您的模型具有属性“FirstName”,您可能希望使用空格和冒号显示它,如“First Name:”所示,如下所示:
public string FirstName { get; set; } [DisplayName("First Name:")]