DisplayFormatAttribute::NullDisplayText Property

 

Gets or sets the text that is displayed for a field when the field's value is null.

Namespace:   System.ComponentModel.DataAnnotations
Assembly:  System.ComponentModel.DataAnnotations (in System.ComponentModel.DataAnnotations.dll)

public:
property String^ NullDisplayText {
	String^ get();
	void set(String^ value);
}

Property Value

Type: System::String^

The text that is displayed for a field when the field's value is null. The default is an empty string (""), which indicates that this property is not set.

Sometimes a data field's value is stored as null values in the source. You can specify custom text to display for data fields that have a null value by setting the NullDisplayText property. If this property is not set, null field values are displayed as empty strings ("").

System_CAPS_noteNote

To convert an empty string field value to a null value, you must set the ConvertEmptyStringToNull property to true.

The following example shows how to use the NullDisplayText to define a caption to display when the data field is null.

No code example is currently available or this language may not be supported.

Universal Windows Platform
Available since 8
.NET Framework
Available since 3.5
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 3.0
Return to top
Show: