Muokkaa

Jaa


DisplayFormatAttribute.ConvertEmptyStringToNull Property

Definition

Gets or sets a value that indicates whether empty string values ("") are automatically converted to null when the data field is updated in the data source.

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

Property Value

true if empty string values are automatically converted to null; otherwise, false. The default is true.

Examples

The following example shows how to use the ConvertEmptyStringToNull to enable the conversion of empty string values to null.

// 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

Remarks

Users might enter an empty string for a field value. Use the ConvertEmptyStringToNull property to specify whether an empty string value is automatically converted to null when the data field is updated in the database.

Note

By default, a DynamicField object displays null values as empty strings. To display a different value, set the NullDisplayText property.

Applies to