DekGenius.com
[ Team LiB ] Previous Section Next Section

ToolboxDataAttribute

System.Web.UI (system.web.dll)sealed class

This attribute is used when you are creating your own custom controls (typically by inheriting from System.Web.UI.WebControls.WebControl or Control). By default, designers like Visual Studio .NET will create an empty tag when you drag a control from the toolbox onto the design surface. This empty tag represents a control in its default state. Rather than using the empty tag, you can specify initial values and default HTML will be placed inside the control tag by using this attribute. For example, the attribute <ToolboxData("<{0}:MyLabel Text='MyLabel' BackColor='Yellow' runat='server'></{0}:MyLabel>")> configures the initial tag for a custom label control with a yellow background. Note that all occurrences of {0} in the supplied Data string will be replaced, by the designer, with the tag prefix associated with the MyLabel class.

public sealed class ToolboxDataAttribute : Attribute {
// Public Constructors
   public ToolboxDataAttribute(string data);
// Public Static Fields
   public static readonly ToolboxDataAttribute Default; // =System.Web.UI.ToolboxDataAttribute
// Public Instance Properties
   public string Data{get; }
// Public Instance Methods
   public override bool Equals(object obj);        // overrides Attribute
   public override int GetHashCode( );               // overrides Attribute
   public override bool IsDefaultAttribute( );       // overrides Attribute
}

Hierarchy

System.Object System.Attribute ToolboxDataAttribute

Valid On

Class

    [ Team LiB ] Previous Section Next Section