是否可以有多个<;模板>;asp.net中自定义控件中定义的区域?

是否可以有多个<;模板>;asp.net中自定义控件中定义的区域?,asp.net,custom-controls,Asp.net,Custom Controls,我目前有: <uc:MyControl ...> <Template> </Template> </uc:Mycontrol> 我想要 <uc:MyControl ...> <FishBiscuit> html </FishBiscuit> <FishBiscuit> html </FishBiscuit> <FishBiscuit> html </FishBisc

我目前有:

<uc:MyControl ...>
<Template>
</Template>
</uc:Mycontrol>

我想要

<uc:MyControl ...>
<FishBiscuit>
html
</FishBiscuit>
<FishBiscuit>
html
</FishBiscuit>
<FishBiscuit>
html
</FishBiscuit>
<FishBiscuit>
html
</FishBiscuit>
.
.
.

html
html
html
html
.
.
.


然而,我不确定这是否可能,或者如果可能的话,如何连接它。有什么想法吗?

它们必须是不同的属性:

[
PersistenceMode(PersistenceMode.InnerProperty),
TemplateInstance(TemplateInstance.Single)
]
public ITemplate FishBiscuit { get; set; }

[
PersistenceMode(PersistenceMode.InnerProperty),
TemplateInstance(TemplateInstance.Single)
]
public ITemplate FishBiscuit2 { get; set; }
上面定义的每个模板都转换为一个属性,因此它必须有一个匹配的属性名称


嗯。

你选择的方法似乎真的不可能。下一个标记

<uc:MyControl runat="server">
    <FishBiscuit>
        html1
    </FishBiscuit>
    <FishBiscuit>
        html2
    </FishBiscuit>
</uc:MyControl>
这更接近您提出的标记

<asp:MultiView runat="server">
    <asp:View runat="server">
        html
    </asp:View>
    <asp:View runat="server">
        html
    </asp:View>
    <asp:View runat="server">
        html
    </asp:View>
    <asp:View runat="server">
        html
    </asp:View>
</asp:MultiView>