語言

DynamicControl.DataFormatString 屬性

定義

取得或設定一個字串,指定欄位值的顯示格式。

public:
 property System::String ^ DataFormatString { System::String ^ get(); void set(System::String ^ value); };
public string DataFormatString { get; set; }
member this.DataFormatString : string with get, set
Public Property DataFormatString As String

屬性值

一個格式字串,用來指定欄位值的顯示格式。 預設為空字串(“”),表示欄位值未套用特殊格式。

備註

使用該 DataFormatString 屬性指定控制項中顯示 DynamicControl 值的自訂顯示格式。 如果屬性未設定, DataFormatString 欄位值會顯示,且不會有特殊格式。

預設情況下,只有當屬性 Mode 設為 ReadOnly時,格式字串才會套用到欄位值。 在編輯模式下,若要將格式字串套用到欄位值,請將屬性設 ApplyFormatInEditMode 為 true。

你用該 DataFormatString 屬性指定的顯示格式是針對這個控制項實例 DynamicControl 特有的。 你也可以透過將 套 DisplayFormatAttribute 用到資料模型中,並在建構子中設定 DisplayFormatAttribute.DataFormatString 命名參數,來改變整個應用程式資料欄位的顯示格式。 欲了解更多資訊,請參閱 動態資料 ASP.NET。

適用於

另請參閱