禁止ASP.NET MVC模型绑定时将空字符串绑定为null

为model添加[DisplayFormat(ConvertEmptyStringToNull = false)]

[DisplayFormat(ConvertEmptyStringToNull = false)]
public string ContactPhone { get; set; }

 

posted @ 2019-04-28 14:49  唔愛吃蘋果  阅读(622)  评论(0编辑  收藏  举报