具有嵌套列表视图(具有动态项)asp.net的动态TabPanel

时间:2013-02-27 11:57:26

标签: asp.net ajax webforms tabcontrol

我有TabControl(AjaxToolKit)有2个嵌套ListViews。

代码:

    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <asp:TabContainer ID="tcQuestions" runat="server" ActiveTabIndex="0"    OnDemand="true" AutoPostBack="false" TabStripPlacement="Top" ScrollBars="None" UseVerticalStripPlacement="false">
        <asp:TabPanel ID="tpFirst" runat="server" HeaderText="Page 1" Enabled="true" ScrollBars="Auto"
            OnDemandMode="Once">
            <ContentTemplate>
                <asp:Panel ID="pnlNoData" runat="server">
                    <asp:LinkButton ID="lbQuestionsAdd" Text="Add Question" runat="server" />    
                </asp:Panel>

                <asp:Panel ID="pnlListView" runat="server">
                    <asp:ListView ID="lsvQuestions" runat="server" ItemPlaceholderID="phItemPlaceHoler">
                        <EmptyDataTemplate>
                            <em>NO RECORD WAS FOUND</em>                            
                       </EmptyDataTemplate>
                       <ItemTemplate>
                            <tr>
                                <td>
                                    <asp:Label ID="lblQuestionID" Text='<%#Eval("intQuesId") %>' Visible="false" runat="server" />
                                    <asp:Label ID="lblQuestionTitle" Text='<%#Eval("strQuesTitle") %>' runat="server" />
                                    <%--1.Are you doing job?--%>
                                </td>
                            </tr>
                            <%--Inner Listview--%>
                            <asp:ListView ID="lsvAnswers" runat="server" ItemPlaceholderID="phItemPlaceHolerAnswers">
                                <LayoutTemplate>
                                    <table runat="server" id="table1">
                                        <tr runat="server" id="phItemPlaceHolerAnswers">
                                        </tr>
                                    </table>
                                </LayoutTemplate>
                                <ItemTemplate>
                                    <tr>
                                        <td>
                                            <asp:PlaceHolder ID="plControl" runat="server" />
                                        </td>
                                    </tr>
                                </ItemTemplate>
                                <EmptyDataTemplate>
                                    <em>NO RECORD WAS FOUND</em>
                                </EmptyDataTemplate>
                            </asp:ListView>                            
                       </ItemTemplate>
                       <LayoutTemplate>
                            <table class="tblAll">
                                <tbody>
                                    <tr>
                                        <td style="width: 125px">
                                            <asp:LinkButton ID="lbtnAddQuestions" runat="server">Add Questions</asp:LinkButton>
                                        </td>
                                        <td style="width: 316px">
                                            <asp:LinkButton ID="lbtnDesignTools" runat="server">Design Tools</asp:LinkButton>
                                        </td>
                                        <td class="formTopLinks">
                                            <img class="imgicons" src="../Layout/images/edit.png" />
                                            <asp:LinkButton ID="lbEditProperties" runat="server" CssClass="lnkbuttonText">Edit Properties</asp:LinkButton>
                                        </td>
                                        <td class="formTopLinks">
                                            <img class="imgicons" src="../Layout/images/Delete.png" />
                                            <asp:LinkButton ID="lbCopyPage" runat="server" CssClass="lnkbuttonText">Copy Page</asp:LinkButton>
                                        </td>
                                        <td class="formTopLinks">
                                            <img class="imgicons" src="../Layout/images/Copy.png" />
                                            <asp:LinkButton ID="lbDeletePage" runat="server" CssClass="lnkbuttonText">Delete Page</asp:LinkButton>
                                        </td>
                                        <td style="width: 20px;">
                                            <img class="imgicons" src="../Layout/images/left.png" />
                                        </td>
                                        <td style="width: 64px;">
                                            <asp:Label ID="Label1" runat="server" CssClass="lnkbuttonText" Text="Move Page" />
                                        </td>
                                        <td style="width: 20px;">
                                            <img class="imgicons" src="../Layout/images/right.png" />
                                        </td>
                                        <td>
                                            &#160;
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                            <br />
                            <table class="tblAll">
                                <tbody>
                                    <asp:PlaceHolder ID="phItemPlaceHoler" runat="server"></asp:PlaceHolder>
                                </tbody>
                            </table>                            
                       </LayoutTemplate>
                  </asp:ListView>    
              </asp:Panel>                   
          </ContentTemplate>            
      </asp:TabPanel>
  </asp:TabContainer>

在哪里,我从表“问题”得到问题,并从另一个表“答案”得到答案。每个问题都与PageNumber相关联。

所以,我必须根据问题中的TabPanels创建PageNumber,然后使用该问题绑定问题标签,并在第2个ListView填写该问题的答案。

这些答案是基于数据库条目的动态控制,例如textboxcheckboxlistsradiobutton lists,并且每个问题可能会有所不同。

现在我正在做的是将tabPanel 1复制到新TabPanel并根据db值添加问题和答案,但是当我创建第二个TabPanel时,它会给我错误

Cannot unregister UpdatePanel with ID 'ContentPlaceHolder1_tcQuestions_tpFirst_updatePanel' since it was not registered with the ScriptManager. This might occur if the UpdatePanel was removed from the control tree and later added again, which is not supported.

处理此场景的最佳方法是什么?

类似SurverMonkey之类的东西,除了我使用新页面的标签。

0 个答案:

没有答案