.NET Framework Class Library
PersistenceModeAttribute Class

Defines the metadata attribute that specifies how an ASP.NET server control property or event is persisted to an ASP.NET page at design time. This class cannot be inherited.

Inheritance Hierarchy

Namespace:   System.Web.UI
Assembly:  System.Web (in System.Web.dll)
<[%$TOPIC/f160d5xe_en-us_VS_110_2_0_0_0_0%]([%$TOPIC/f160d5xe_en-us_VS_110_2_0_0_0_1%].All)> _
Public NotInheritable Class PersistenceModeAttribute _
	Inherits [%$TOPIC/f160d5xe_en-us_VS_110_2_0_0_0_2%]
public sealed class PersistenceModeAttribute : [%$TOPIC/f160d5xe_en-us_VS_110_2_0_1_0_2%]
public ref class PersistenceModeAttribute sealed : public [%$TOPIC/f160d5xe_en-us_VS_110_2_0_2_0_2%]
type PersistenceModeAttribute =  
        inherit [%$TOPIC/f160d5xe_en-us_VS_110_2_0_3_0_3%] 
public final class PersistenceModeAttribute extends [%$TOPIC/f160d5xe_en-us_VS_110_2_0_4_0_0%]

The PersistenceModeAttribute type exposes the following members.

Public method PersistenceModeAttributeInfrastructure. Initializes a new instance of the PersistenceModeAttribute class.
Public property ModeGets the current value of the PersistenceMode enumeration.
Public property TypeIdWhen implemented in a derived class, gets a unique identifier for this Attribute. (Inherited from Attribute.)
Public method EqualsInfrastructure. Compares the PersistenceModeAttribute object against another object. (Overrides AttributeEquals(Object).)
Public method GetHashCodeInfrastructure. Provides a hash value for a PersistenceModeAttribute attribute. (Overrides AttributeGetHashCode.)
Public method GetTypeGets the Type of the current instance. (Inherited from Object.)
Public method IsDefaultAttributeInfrastructure. Indicates whether the PersistenceModeAttribute object is of the default type. (Overrides AttributeIsDefaultAttribute.)
Public method MatchWhen overridden in a derived class, returns a value that indicates whether this instance equals a specified object. (Inherited from Attribute.)
Public method ToStringReturns a string that represents the current object. (Inherited from Object.)
Public field Static member AttributeSpecifies that the property or event persists in the opening tag of the server control as an attribute. This field is read-only.
Public field Static member DefaultSpecifies the default type for the PersistenceModeAttribute class. The default is PersistenceMode.Attribute. This field is read-only.
Public field Static member EncodedInnerDefaultPropertySpecifies that a property is HTML-encoded and persists as the only inner content of the ASP.NET server control. This field is read-only.
Public field Static member InnerDefaultPropertySpecifies that a property persists as the only inner content of the ASP.NET server control. This field is read-only.
Public field Static member InnerPropertySpecifies that the property persists as a nested tag within the opening and closing tags of the server control. This field is read-only.
Explicit Interface Implementations
Explicit interface implemetation Private method _AttributeGetIDsOfNamesMaps a set of names to a corresponding set of dispatch identifiers. (Inherited from Attribute.)
Explicit interface implemetation Private method _AttributeGetTypeInfoRetrieves the type information for an object, which can be used to get the type information for an interface. (Inherited from Attribute.)
Explicit interface implemetation Private method _AttributeGetTypeInfoCountRetrieves the number of type information interfaces that an object provides (either 0 or 1). (Inherited from Attribute.)
Explicit interface implemetation Private method _AttributeInvokeProvides access to properties and methods exposed by an object. (Inherited from Attribute.)

For more information about using attributes, see Extending Metadata Using Attributes.


The Web page designer in Visual Studio does not support the ResetPropertyName method that is optionally exposed by Windows Forms controls for property persistence. Server controls are serialized using methods provided by the ControlPersister class. The implementation of these methods is driven by metadata attributes such as DefaultValueAttribute, PersistenceModeAttribute, and DesignerSerializationVisibilityAttribute.


      <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;
Version Information

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.