PersistenceMode Enumeration
Collapse the table of content
Expand the table of content

PersistenceMode Enumeration

Specifies how an ASP.NET server control property or event is persisted declaratively in an .aspx or .ascx file.

[Visual Basic]
Public Enum PersistenceMode
public enum PersistenceMode
__value public enum PersistenceMode
enum PersistenceMode


Member name Description
Attribute Specifies that the property or event persists as an attribute.
EncodedInnerDefaultProperty 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 Specifies that the property persists in the ASP.NET server control as a 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 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.


[Visual Basic, C#, C++] The following example demonstrates an ITemplate property that will be persisted as an inner property as defined by applying the PersistenceModeAttribute to the property's metadata.

[Visual Basic] 

      <PersistenceMode(PersistenceMode.InnerProperty), TemplateContainer(GetType(TemplateItem))> Public Property MessageTemplate() As ITemplate
            Return _messageTemplate
         End Get
         Set(ByVal Value As ITemplate)
            _messageTemplate = Value
         End Set
      End Property

public ITemplate MessageTemplate {
   get {
      return _messageTemplate;
   set {
      _messageTemplate = value;

   __property ITemplate* get_MessageTemplate() {
      return _messageTemplate;
   __property void set_MessageTemplate( ITemplate* value ) {
      _messageTemplate = value;

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.


Namespace: System.Web.UI

Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family

Assembly: System.Web (in System.Web.dll)

See Also

System.Web.UI Namespace | PersistenceModeAttribute

© 2015 Microsoft