This documentation is archived and is not being maintained.

PersistChildrenAttribute.UsesCustomPersistence Property

Gets a value indicating whether the server control provides custom persistence of nested controls at design time.

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

public bool UsesCustomPersistence { get; }

Property Value

Type: System.Boolean
true to provide custom persistence of nested content; otherwise, false. The default is false.

To configure nested content for custom persistence, use the PersistChildrenAttribute overload that takes a usesCustomPersistence parameter.

The following code example demonstrates how to get the value of the UsesCustomPersistence property.

This code example is part of a larger example provided for the PersistChildrenAttribute class.

<%@ Page Language="C#" %>
<%@ Register TagPrefix="AspSample" Assembly="Samples.AspNet.CS.Controls" Namespace="PersistChildrenSamples" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

<script runat="server">

  protected void Page_Load(object sender, EventArgs e)

    // Create two new employees and add them to the custom control.
    Employee e1 = new Employee("Employee 1", "Title 1", "Alias 1");
    Employee e2 = new Employee("Employee 2", "Title 2", "Alias 2");

    // Verify attribute values.
    PersistChildrenAttribute p =

    StringBuilder sb = new StringBuilder();
    sb.Append("The Persist property is " + p.Persist.ToString() + "<br />");
    sb.Append("The UseCustomPersistence property is " + p.UsesCustomPersistence.ToString() + "<br />");
    sb.Append("The IsDefault method returns " + p.IsDefaultAttribute().ToString());
    Message.Text = sb.ToString();


<html xmlns="" >
<head runat="server">
    <form id="form1" runat="server">
      <asp:Label ID="Message"
      <AspSample:CollectionPropertyControl id="CollectionPropertyControl1" 

.NET Framework

Supported in: 4, 3.5, 3.0, 2.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.