Click here to Skip to main content
15,887,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am designing an ASP.NET v3.5 custom control based on CompositeControl.

However, I do NOT want to create my child controls via code, but rather as embedded HTML tag elements within the CompositeControl in the ASPX page, such as:
<cc:MyCompositeControl ID="MyControl"> 
    <asp:Label>Cat</asp:Label> 
    <asp:Label>Cat</asp:Label> 
</cc:MyCompositeControl>

At run time, MyControl.Controls contains the two labels as expected.

At design time, MyControl.Controls is empty.

I need this information at design time for various reasons.

What am I doing wrong?
Posted
Updated 23-Jun-10 22:05pm
v2

1 solution

Well you need to override GetDesignTimeHtml method. Create a designer class for your control and override it.

Have a look at this article. This has an example of how to show design time HMTL: Customizable 'Loading' Control for Web Applications with Designer Support[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900