Реализация класса, расширяющего Panel и реализующего INamingContainer:
public class Container: Panel, INamingContainer
{
}
Затем вашей CustomPanel необходимо предоставить свойство типа Container и другое свойство типа ITemplate:
public Container ContainerContent
{
get
{
EnsureChildControls();
return content;
}
}
[TemplateContainer(typeof(Container))]
[TemplateInstance(TemplateInstance.Single)]
public virtual ITemplate Content
{
get { return templateContent; }
set { templateContent = value; }
}
Затем в методе CreateChildControls()
добавить это:
if (templateContent != null)
{
templateContent.InstantiateIn(content);
}
И вы будете использовать это так:
<uc:customPanel title="My panel">
<Content>
<h1>Here we can add whatever HTML or ASP controls we would like.</h1>
<asp:TextBox></asp:TextBox>
</Content>
</uc:customPanel>