This documentation is archived and is not being maintained.

ControlValuePropertyAttribute Class

Specifies the default property of a control that a ControlParameter object binds to at run time. This class cannot be inherited.

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

[AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
public sealed class ControlValuePropertyAttribute : Attribute

When defining a ControlParameter object, you typically bind a control's property to a parameter by setting both the ControlID and PropertyName properties. If the PropertyName property is not set, a default property is used. The ControlValuePropertyAttribute attribute is applied to a control to specify its default property that a ControlParameter object binds to at run time.

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

For a list of initial property values for an instance of the ControlValuePropertyAttribute class, see the ControlValuePropertyAttribute constructor.

The following code example demonstrates how to apply a ControlValuePropertyAttribute attribute that specifies a default property and value to a custom control.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Samples.AspNet.CS.Controls
    // Set ControlValueProperty attribute to specify the default 
    // property of this control that a ControlParameter object  
    // binds to at run time.
    [ControlValueProperty("Text", "Default Text")]
    public class SimpleCustomControl : WebControl
        private string text;

        public string Text
                return text;
                text = value;

        protected override void Render(HtmlTextWriter output)


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

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

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

.NET Framework

Supported in: 3.5, 3.0, 2.0