Lire en anglais Modifier

Partager via


PersistenceMode Enum

Definition

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

public enum PersistenceMode
Inheritance
PersistenceMode

Fields

Name Value Description
Attribute 0

Specifies that the property or event persists as an attribute.

InnerProperty 1

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 2

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 3

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.

Examples

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.

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

Applies to

Produit Versions
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

See also