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인 경우 해당 필드에 대해 표시되는 텍스트입니다. 기본값은 빈 문자열("")로, 이 속성이 설정되어 있지 않음을 나타냅니다.

예제

다음 예제에서는 를 사용하여 데이터 필드nullNullDisplayText 일 때 표시할 캡션 정의하는 방법을 보여줍니다.

// 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 해야 합니다.

적용 대상

추가 정보