ozymandias
asked on
Custom ASP.NET Control - Design-time rendering
I have created a custom asp.net web control.
I have done this by extending System.Web.UI.WebControls. Panel like this :
[DefaultProperty("Text"), ToolboxData("<{0}:WebCusto mControl1 runat=server></{0}:WebCust omControl1 >")]
public class WebCustomControl1 : System.Web.UI.WebControls. Panel{
}
Internally I have added some labels, buttons and textboxes to the panel, exposed some bindable attributes and events etc.
I have added it to my toolbox and can drag and drop it onto the form.
It all works fine and renders beautifully on the web page.
However, in the VS2003 designer it only renders the outer panel and not the inner controls.
How can I get it to look like it does at runtime in design time ?
I have done this by extending System.Web.UI.WebControls.
[DefaultProperty("Text"), ToolboxData("<{0}:WebCusto
public class WebCustomControl1 : System.Web.UI.WebControls.
}
Internally I have added some labels, buttons and textboxes to the panel, exposed some bindable attributes and events etc.
I have added it to my toolbox and can drag and drop it onto the form.
It all works fine and renders beautifully on the web page.
However, in the VS2003 designer it only renders the outer panel and not the inner controls.
How can I get it to look like it does at runtime in design time ?
ASKER
I thought I might have to override some of the methods of the ControlDesigner but I don't, so in fact the answer is just to add this :
[DesignerAttribute(typeof( System.Web .UI.Design .ControlDe signer), typeof(IDesigner))]
to the class declaration.
[DesignerAttribute(typeof(
to the class declaration.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
[DefaultProperty("Text"), ToolboxData("<{0}:WebCusto
[DesignerAttribute(typeof(
public class WebCustomControl1 : System.Web.UI.WebControls.
}
public class WebCustomControl1Designer : System.Web.UI.Design.Contr
public WebCustomControl1Designer(
}
}