由网友(好了伤疤忘了疼)分享简介:我们可以将某种方式的格式呢?Can we apply somehow the format for this?[Display(Name = "Date of Birthday")][DataType(DataType.Date)]public DateTime DOB { get; set; }我想看到的只有...
我们可以将某种方式的格式呢?
Can we apply somehow the format for this?
[Display(Name = "Date of Birthday")]
[DataType(DataType.Date)]
public DateTime DOB { get; set; }
我想看到的只有日期,而不是时间。
I'd like to see only Date and not Time.
感谢您!
推荐答案
您可以使用的 DisplayFormatAttribute 的
指定如何数据字段的显示和格式由ASP.NET动态数据。
Specifies how data fields are displayed and formatted by ASP.NET Dynamic Data.
http://msdn.microsoft.com/en-us/library/system.componentmodel.dataannotations.displayformatattribute.aspx
[DisplayFormat(DataFormatString = "{0:dd MMM yyyy}")]
[Display(Name = "Date of Birthday")]
[DataType(DataType.Date)]
public DateTime DOB { get; set; }
相关推荐
最新文章