【发布时间】:2013-08-12 19:02:18
【问题描述】:
我正在使用 ASP.NET WebApi,在将结果发送到 JSON 时,是否可以在模型 - ModelMetadata 上发送数据注释 例如 DisplayName 属性、 ShowInEdit 、 ShowInDispplay 和其他自定义属性以及 Fieldnmae 和 value。
public class Role
{
public Role()
{
Users = new List<User>();
}
[ScafoldingColumn(false)]
public int RoleId { get; set; }
[DisplayName("Role Name")]
[Required]
[ShowForDisplay(true)]
[ShowForEdit(true)]
public string RoleName { get; set; }
[ShowForDisplay(true)]
public ICollection<User> Users { get; set; }
}
提前致谢
【问题讨论】:
-
您能提供您的 C# 类和您想要的示例吗?
标签: c# javascript jquery asp.net-mvc asp.net-web-api