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. This class cannot be inherited.

For a list of all members of this type, see PersistenceModeAttribute Members.


[Visual Basic]
NotInheritable Public Class PersistenceModeAttribute
   Inherits Attribute
public sealed class PersistenceModeAttribute : Attribute
public __gc __sealed class PersistenceModeAttribute : public
class PersistenceModeAttribute extends Attribute

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.


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

Note   The Web Forms designer does not support the ShouldSerializePropertyName and ResetPropertyName methods that are 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.


[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

PersistenceModeAttribute Members | System.Web.UI Namespace | Attribute