don't display datetime min value in gridview

前端 未结 3 1309
死守一世寂寞
死守一世寂寞 2021-01-21 16:19

given:

public class Customer
{
    public int Id { get; set; }
    public string FirstName { get; set; }
    public DateTime Birthdate { get; set; }
}

3条回答
  •  清歌不尽
    2021-01-21 16:25

    Alternatively, you can update your front-end GridView display to hide out the DateTime.MinValue as follow:

    
    <%# (DateTime)Eval("LastRequestDate").Equals(DateTime.MinValue) ? "" : string.Format("{0:dd/MM/yyyy hh:mm:ss tt}", (DateTime)Eval("LastRequestDate")) %>
    

提交回复
热议问题