다음을 통해 공유


DisplayFormatAttribute.ConvertEmptyStringToNull 속성

정의

데이터 원본에서 데이터 필드가 업데이트되는 경우 빈 문자열 값("")이 자동으로 변환 null 되는지 여부를 나타내는 값을 가져오거나 설정합니다.

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

속성 값

true 빈 문자열 값이 자동으로 변환되면 이고 null, false그렇지 않으면 . 기본값은 true입니다.

예제

다음 예제에서는 빈 문자열 값을 변환할 ConvertEmptyStringToNull 수 있도록 하는 방법을 보여 줍니다 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

설명

사용자는 필드 값에 빈 문자열을 입력할 수 있습니다. ConvertEmptyStringToNull 이 속성을 사용하여 빈 문자열 값이 데이터베이스에서 데이터 필드를 업데이트할 null 때 자동으로 변환되는지 여부를 지정합니다.

메모

기본적으로 개체는 DynamicField 값을 빈 문자열로 표시 null 합니다. 다른 값을 표시하려면 속성을 설정합니다 NullDisplayText .

적용 대상