This documentation is archived and is not being maintained.

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.


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

public ref class PersistenceModeAttribute sealed : public Attribute

The PersistenceModeAttribute type exposes the following members.

Public methodPersistenceModeAttributeInfrastructure. Initializes a new instance of the PersistenceModeAttribute class.

Public propertyModeGets the current value of the PersistenceMode enumeration.
Public propertyTypeIdWhen implemented in a derived class, gets a unique identifier for this Attribute. (Inherited from Attribute.)

Public methodEqualsInfrastructure. Compares the PersistenceModeAttribute object against another object. (Overrides Attribute::Equals(Object).)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetHashCodeInfrastructure. Provides a hash value for a PersistenceModeAttribute attribute. (Overrides Attribute::GetHashCode().)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodIsDefaultAttributeInfrastructure. Indicates whether the PersistenceModeAttribute object is of the default type. (Overrides Attribute::IsDefaultAttribute().)
Public methodMatchWhen overridden in a derived class, returns a value that indicates whether this instance equals a specified object. (Inherited from Attribute.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)

Public fieldStatic memberAttributeSpecifies that the property or event persists in the opening tag of the server control as an attribute. This field is read-only.
Public fieldStatic memberDefaultSpecifies the default type for the PersistenceModeAttribute class. The default is PersistenceMode.Attribute. This field is read-only.
Public fieldStatic memberEncodedInnerDefaultPropertySpecifies 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 fieldStatic memberInnerDefaultPropertySpecifies that a property persists as the only inner content of the ASP.NET server control. This field is read-only.
Public fieldStatic memberInnerPropertySpecifies 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 implemetationPrivate method_Attribute::GetIDsOfNamesMaps a set of names to a corresponding set of dispatch identifiers. (Inherited from Attribute.)
Explicit interface implemetationPrivate method_Attribute::GetTypeInfoRetrieves the type information for an object, which can be used to get the type information for an interface. (Inherited from Attribute.)
Explicit interface implemetationPrivate method_Attribute::GetTypeInfoCountRetrieves the number of type information interfaces that an object provides (either 0 or 1). (Inherited from Attribute.)
Explicit interface implemetationPrivate method_Attribute::InvokeProvides 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.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

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

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.