TemplateField.ConvertEmptyStringToNull 屬性


取得或設定值,該值指示是否應將 TemplateField 物件繫結至的值轉換成 null (如果其為 Empty)。Gets or sets a value indicating whether the value that the TemplateField object is bound to should be converted to null if it is Empty.

 virtual property bool ConvertEmptyStringToNull { bool get(); void set(bool value); };
public virtual bool ConvertEmptyStringToNull { get; set; }
member this.ConvertEmptyStringToNull : bool with get, set
Public Overridable Property ConvertEmptyStringToNull As Boolean



如果應將 TemplateField 繫結至的值轉換成 true (當其為 Empty 時),則為 null,否則為 falsetrue if the value that the TemplateField is bound to should be converted to null when it is Empty; otherwise, false. 預設值是 falseThe default value is false.


這個屬性會套用至範本中所建立的雙向資料繫結語句。This property applies to two-way data-binding statements made in the template. 從雙向系結範本中解壓縮值之後,以及將值傳遞至資料來源以進行更新或插入作業之後,就會進行轉換。The conversion is done after extracting the values from the two-way bound template, and before passing the values to the data source for an update or insertion operation.

例如,使用者在更新或插入記錄時,可能會為域值輸入空字串 ( "" ) 。For example, a user might enter an empty string ("") for a field value when updating or inserting records. ConvertEmptyStringToNull 可以使用屬性來指定 null 當資料欄位在資料來源中更新時,是否自動將空字串值轉換為。Use the ConvertEmptyStringToNull property to specify whether an empty string value is automatically converted to null when the data field is updated in the data source.