简体   繁体   English

如何在模板化FormView中使用TabContainer控件?

[英]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.

相关问题 FormView中具有属性[TemplateInstance(TemplateInstance.Single)]的模板化控件出错 - Error with templated control with attribute [TemplateInstance(TemplateInstance.Single)] inside FormView 如何将ObjectDataSource与复杂对象和FormView控件一起使用 - How To Use ObjectDataSource With Complex Objects and FormView Control 在formview中使用下拉列表控件 - Using a dropdownlist control inside a formview 如何在诸如FormView的数据控件中显示表格的导航属性? - How to display a Navigation Property of a table inside a Data control like a FormView? 如何在TabContainer和FileUpload中使用UpdatePanel? - How to use UpdatePanel with TabContainer and FileUpload? 将登录用户分配给 FormView 控件内的文本框 - Assign Logged in User to Textbox inside a FormView Control FormView控件内的LoginView不在PostBack上进行数据绑定 - LoginView inside FormView control is not databinding on PostBack RadDockZone内部的模板化RadDock控件? - Templated RadDock control inside of a RadDockZone? Subgurim Maps控件不会在Formview中呈现 - Subgurim maps control wont render inside a Formview 用户控件内部的Formview的FindControl - FindControl of a Formview which is inside an user control
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM