[英]How to use the TabContainer control inside a templated FormView?
Is it possible to use a TabContainer inside a templated FormView like so: 是否可以在模板化FormView内使用TabContainer,如下所示:
<ItemTemplate>
<cc1:TabContainer ID="TabContainer1" runat="server">
<cc1:TabPanel ID="Tab1" runat="server">
<HeaderTemplate>Tab One</HeaderTemplate>
<ContentTemplate>
... bound fields
</ContentTemplate>
</cc1:TabPanel>
<cc1:TabPanel ID="Tab2" runat="server">
<HeaderTemplate>Tab 2</HeaderTemplate>
<ContentTemplate>
... bound fields
</ContentTemplate>
</cc1:TabPanel>
</cc1:TabContainer>
</ItemTemplate>
<EditTemplate>
<cc1:TabContainer ID="TabContainer1" runat="server">
<cc1:TabPanel ID="Tab1" runat="server">
<HeaderTemplate>Tab One</HeaderTemplate>
<ContentTemplate>
... bound fields
</ContentTemplate>
</cc1:TabPanel>
<cc1:TabPanel ID="Tab2" runat="server">
<HeaderTemplate>Tab 2</HeaderTemplate>
<ContentTemplate>
... bound fields
</ContentTemplate>
</cc1:TabPanel>
</cc1:TabContainer>
</EditTemplate>
Everything works fine for only one template view at a time; 一次只适用于一个模板视图,一切正常。 for example if ItemTemplate works then EditTemplate won't.
例如,如果ItemTemplate有效,则EditTemplate将无效。 ASP.NET will complain about duplicate bound field IDs.
ASP.NET将抱怨重复的绑定字段ID。
Has anybody tried doing what I'm trying to do? 是否有人尝试做我想做的事?
Thanks.- Gene 谢谢-基因
EDIT : 编辑:
I don't think the tab containers with the same IDs is the issue here since they are both inside separate Template elements and only one Template gets rendered at a time. 我不认为具有相同ID的标签容器在这里不是问题,因为它们都位于单独的Template元素内,并且一次仅呈现一个Template。
UPDATE: 更新:
I didn't manage to find a solution, and I think it's not possible. 我没有找到解决方案,但我认为这是不可能的。 So, just moved on and use unique IDs.
因此,继续前进并使用唯一的ID。 Being lazy, I wrote some code to automate the dreaded naming process.
懒惰的我写了一些代码来自动执行可怕的命名过程。 I hope someone out there has a better answer to share.
我希望有更好的答案可以分享。 Anyway, I'm too poor to afford to put a bounty on it.
无论如何,我实在是太穷了,无法负担赏金。 ;-)
;-)
Haven't used the Tab container much but you need to define unique ID's for each element on the page. 没有使用Tab容器,但是您需要为页面上的每个元素定义唯一的ID。
<cc1:TabContainer ID="TabContainer1" runat="server">
<cc1:TabContainer ID="TabContainer2" runat="server">
我通过更改每个选项卡中的重复字段名称来解决此难题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.