ToolboxDataAttribute

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.