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.
System.Object
System.Attribute
System.Web.UI.PersistenceModeAttribute
[Visual Basic] <AttributeUsage(AttributeTargets.All)> NotInheritable Public Class PersistenceModeAttribute Inherits Attribute [C#] [AttributeUsage(AttributeTargets.All)] public sealed class PersistenceModeAttribute : Attribute [C++] [AttributeUsage(AttributeTargets::All)] public __gc __sealed class PersistenceModeAttribute : public Attribute [JScript] public AttributeUsage(AttributeTargets.All) 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.
Remarks
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.
Example
[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; } } [C++] public: [PersistenceMode(PersistenceMode::InnerProperty), TemplateContainer(__typeof(TemplateItem))] __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
in the upper-left corner of the page.
Requirements
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