Hi Pipo,
As for defining a Custom ControlDesigner for a custom webcontrol, we can
follow the following steps:
1. Create a custom controldesigner, for example:
========Control Designer class=============
public class TestControlDesigner : System.Web.UI.Design.ControlDesigner
{
public override string GetDesignTimeHtml()
{
string html = "";
html = "<center><div>This is the design-time html!</div></center>"
return html;
}
.....................
}
# The "GetDesignTimeHtml" method just help to provide the html that will
be output at the control's design-time(in IDE). It'll override the default
behavior of the control
#ControlDesigner.GetDesignTimeHtml Method
http://msdn.microsoft.com/library/de...us/cpref/html/
frlrfSystemWebUIDesignControlDesignerClassGetDesig nTimeHtmlTopic.asp
2. Apply the Custom Designer onto our CustomControl, just use the
"Designer" Attribute, such as:
[DefaultProperty("Text"),
ToolboxData("<{0}:TestControl runat=server></{0}:TestControl>"),
Designer(typeof(TestControlDesigner))]
public class TestControl : System.Web.UI.Control
{
In addition, here is a good tech article which has a complete tutorial on
developing a custom webcontrol and add rich design-time support for it.
(such as Control Designer, IDE intellisense ...)
#Adding Design-Time Support to ASP.NET Controls
http://msdn.microsoft.com/library/de...us/dnaspp/html
/ASPNet-AddDesignTimeSupport.asp
Hope helps. Thanks
Regards,
Steven Cheng
Microsoft Online Support
Get Secure!
www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)