다음을 통해 공유


DisplayFormatAttribute.NullDisplayText 속성

정의

필드 값 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 값으로 저장되는 경우가 있습니다. 속성을 설정 NullDisplayText 하여 null 값이 있는 데이터 필드에 대해 표시할 사용자 지정 텍스트를 지정할 수 있습니다. 이 속성을 설정하지 않으면 null 필드 값이 빈 문자열("")로 표시됩니다.

메모

빈 문자열 필드 값을 null 값으로 변환하려면 속성을 true.로 설정 ConvertEmptyStringToNull 해야 합니다.

적용 대상

추가 정보