【发布时间】:2010-01-04 19:52:23
【问题描述】:
在我的模型中,我的一个属性上有以下 DataAnnotations
[Required(ErrorMessage = "*")]
[DisplayFormat(DataFormatString = "{0:d}")]
[DataType(DataType.Date)]
public DateTime Birthdate { get; set; }
所需的注释效果很好,我添加了其他 2 个以尝试删除时间。它使用
绑定到视图中的输入<%=Html.TextBoxFor(m => m.Birthdate, new { @class = "middle-input" })%>
但是,每当加载视图时,我仍然会在输入框中显示时间。有没有办法使用 DataAnnotations 删除它?
【问题讨论】:
标签: asp.net-mvc data-annotations