DynamicControl.DataFormatString DynamicControl.DataFormatString DynamicControl.DataFormatString DynamicControl.DataFormatString Property

定義

取得或設定字串,這個字串指定欄位值的顯示格式。Gets or sets a string that specifies the display format for the value of the field.

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

屬性值

指定欄位值顯示格式的格式化字串。A formatting string that specifies the display format for the value of the field. 預設為空字串 (""),表示未將特殊格式套用至該欄位值。The default is an empty string (""), which indicates that no special formatting is applied to the field value.

備註

使用屬性, 即可指定DynamicControl控制項中顯示之值的自訂顯示格式。 DataFormatStringUse the DataFormatString property to specify a custom display format for the values displayed in the DynamicControl control. 如果未設定屬性, 則會顯示域值, 而不需要任何特殊的格式。 DataFormatStringIf the DataFormatString property is not set, the field value is displayed without any special formatting.

根據預設, 只有當Mode屬性設定為ReadOnly時, 才會將格式字串套用至域值。By default, the formatting string is applied to the field value only when the Mode property is set to ReadOnly. 若要在編輯模式中將格式字串套用至域值, 請將ApplyFormatInEditMode屬性設定true為。To apply the formatting string to the field value while in edit mode, set the ApplyFormatInEditMode property to true.

您使用DataFormatString屬性所指定的顯示格式, 是這個DynamicControl控制項實例特有的。The display format that you specify using the DataFormatString property is specific to this instance of the DynamicControl control. 您也可以將套用DisplayFormatAttribute至資料模型, 並在此函式中DisplayFormatAttribute.DataFormatString設定具名引數, 以變更整個應用程式之資料欄位的顯示格式。You can also change the display format for a data field across the entire application by applying the DisplayFormatAttribute to your data model and setting the DisplayFormatAttribute.DataFormatString named parameter in the constructor. 如需詳細資訊, 請參閱ASP.NET 動態資料For more information, see ASP.NET Dynamic Data.

適用於

另請參閱