更新时间:2023-10-15 11:05:10
当我在DateTime字段中具有空值时,此DisplayTemplate最终为我工作:
This DisplayTemplate ended up working for me, when I had null values in the DateTime field:
@model DateTime?
@((@Model != null) ? Model.Value.ToString("MM/dd/yyyy") : "{n/a}" )
当该值为null时,将其替换为字符串:{n/a}
When the value is null, it is replaced with the string: {n/a}