0
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 having to use a template explicitly.
Currently I have it:
<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 of 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 put the controls directly inside my control, without having to place the template? In the same way as the Panel
works...