I want to create a control exactly like a Panel
.
<asp:Panel runat="server">
Conteúdo
<div>Content</div>
</asp:Panel>
I want to be able to put controls inside it without explicitly using a template.
I currently have this:
<my:MyControl runat="server">
<ContentTemplate>
Conteúdo
<div>Conteúdo</div>
</ContentTemplate>
</my:MyControl>
I want to convert to:
<my:MyControl runat="server">
Conteúdo
<div>Conteúdo</div>
</my:MyControl>
The current code for my control is:
public class MyControl : CompositeControl
{
[TemplateInstance(TemplateInstance.Single)]
public ITemplate Content { get; set; }
protected override void CreateChildControls()
{
base.CreateChildControls();
Content.InstantiateIn(this);
}
}
How can I make the controls directly inside my control, without having to put the template? Just as Panel
works ...