Name
ControlDesigner
Synopsis
This is base class for web control designers like System.Web.UI.Design.WebControls.AdRotatorDesigner
. These designers
create the design-time appearance that a control provides to the design editor
(like Visual Studio .NET). This HTML code is provided through the GetDesignTimeHtml()
method, which is called by the host. The base implementation of the GetDesignTimeHtml()
method invokes the System.Web.UI.Control.Render()
method of the appropriate control
to create the same HTML at design time as at runtime. A custom designer
modifies this behavior by overriding the GetDesignTimeHtml()
to
provide HTML that is more suitable for a design-time representation.
You can create your own custom designer to use with a custom System.Web.UI.WebControls.WebControl
. In this case, you use
the System.ComponentModel.DesignerAttribute
on the class
declaration of your control to connect it with the appropriate designer. You can
set various ControlDesigner
properties—the most useful of which is AllowResize
, which
restricts your control to a fixed size. When your control is resized, the
designer will call corresponding methods like OnControlResize()
to give
you a chance to refresh the appearance of your control accordingly.
The GetDesignTimeHtml()
method should call GetEmptyDesignTimeHtml()
if the rendered HTML string is empty (for example, when required control
properties are not set). The base implementation of GetEmptyDesignTimeHtml()
returns the fully qualified name of ...
Get ASP.NET in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.