DisplayFormatAttribute.ConvertEmptyStringToNull 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取或设置一个值,该值指示在数据源中更新数据字段时是否自动转换为 null 空字符串值(“”)。
public:
property bool ConvertEmptyStringToNull { bool get(); void set(bool value); };
public bool ConvertEmptyStringToNull { get; set; }
member this.ConvertEmptyStringToNull : bool with get, set
Public Property ConvertEmptyStringToNull As Boolean
属性值
true。
示例
下面的示例演示如何使用
// Display the text [Null] when the data field is empty.
// Also, convert empty string to null for storing.
[DisplayFormat(ConvertEmptyStringToNull = true, NullDisplayText = "[Null]")]
public object Size;
' Display the text [Null] when the data field is empty.
' Also, convert empty string to null for storing.
<DisplayFormat(ConvertEmptyStringToNull:=True, NullDisplayText:="[Null]")> _
Public Size As Object
注解
用户可能会为字段值输入空字符串。 使用该 ConvertEmptyStringToNull 属性指定在数据库中更新数据字段时是否自动转换为 null 空字符串值。
注释
默认情况下,对象 DynamicField 将值显示为 null 空字符串。 若要显示其他值,请设置 NullDisplayText 属性。