.NET Framework Class Library
PersistenceMode Enumeration

Updated: November 2007

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

Namespace:  System.Web.UI
Assembly:  System.Web (in System.Web.dll)
Visual Basic (Declaration)
Public Enumeration PersistenceMode
Visual Basic (Usage)
Dim instance As PersistenceMode
C#
public enum PersistenceMode
Visual C++
public enum class PersistenceMode
J#
public enum PersistenceMode
JScript
public enum PersistenceMode
Member nameDescription
Attribute Specifies that the property or event persists as an attribute.
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.
InnerDefaultProperty 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.
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.

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.

Visual Basic
<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


C#
[PersistenceMode(PersistenceMode.InnerProperty),
TemplateContainer(typeof(TemplateItem))]
public ITemplate MessageTemplate {
   get {
      return _messageTemplate;
   }
   set {
      _messageTemplate = value;
   }
}

Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1, 1.0
Page view tracker