DisplayFormatAttribute.NullDisplayText プロパティ
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
フィールドの値が null
の場合にフィールドに表示するテキストを取得または設定します。
public:
property System::String ^ NullDisplayText { System::String ^ get(); void set(System::String ^ value); };
public string NullDisplayText { get; set; }
public string? NullDisplayText { get; set; }
member this.NullDisplayText : string with get, set
Public Property NullDisplayText As String
プロパティ値
フィールドの値が null
の場合にフィールドに表示されるテキスト。 既定値は空の文字列 ("") です。このプロパティが設定されていないことを示します。
例
次の例は、 を使用NullDisplayTextして、データ フィールド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
注釈
データ フィールドの値が null 値としてソースに格納される場合があります。 プロパティを設定することで、null 値を持つデータ フィールドに表示するカスタム テキストを NullDisplayText 指定できます。 このプロパティが設定されていない場合、null フィールド値は空の文字列 ("") として表示されます。
注意
空の文字列フィールド値を null 値に変換するには、 プロパティを ConvertEmptyStringToNull に設定する true
必要があります。