views:

23

answers:

1

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?

A: 

You might consider taking a look at the System.Web.UI.WebControls.Panel control in the System.Web DLL using Reflector. That will help you get some idea of what properties and what attribute decorations are necessary to provide the design-time support you need.

kbrimington