PersistenceMode Enum
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Specifies how an ASP.NET server control property or event is persisted declaratively in an .aspx or .ascx file.
public enum class PersistenceMode
public enum PersistenceMode
type PersistenceMode =
Public Enum PersistenceMode
- Inheritance
Fields
Attribute | 0 | Specifies that the property or event persists as an attribute. |
EncodedInnerDefaultProperty | 3 | Specifies that the property persists as the only inner text of the ASP.NET server control. The property value is HTML encoded. Only a string can be given this designation. |
InnerDefaultProperty | 2 | Specifies that the property persists in the ASP.NET server control as inner text. Also indicates that this property is defined as the element's default property. Only one property can be designated the default property. |
InnerProperty | 1 | Specifies that the property persists in the ASP.NET server control as a nested tag. This is commonly used for complex objects, those that have persistable properties of their own. |
Examples
The following code example demonstrates an ITemplate property that will be persisted as an inner property, as defined by applying the PersistenceModeAttribute attribute to the property's metadata.
[PersistenceMode(PersistenceMode.InnerProperty),
TemplateContainer(typeof(TemplateItem))]
public ITemplate MessageTemplate {
get {
return _messageTemplate;
}
set {
_messageTemplate = value;
}
}
<PersistenceMode(PersistenceMode.InnerProperty), TemplateContainer(GetType(TemplateItem))> Public Property MessageTemplate() As ITemplate
Get
Return _messageTemplate
End Get
Set(ByVal Value As ITemplate)
_messageTemplate = Value
End Set
End Property
Applies to
See also
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應