简体   繁体   English

将中继器放在AjaxToolKit手风琴内

[英]Placing a repeater inside an AjaxToolKit Accordion

I am trying to use a repeater inside an AjaxToolKit Accordion. 我正在尝试在AjaxToolKit手风琴内使用中继器。 This is necessary because I need pagination within my DataList using a SQL stored procedure. 这是必要的,因为我需要使用SQL存储过程在DataList中进行分页。 It works fine if I place the repeater outside of the AjaxToolKit Accordion, but I need to place the repeater inside the accordion. 如果将转发器放在AjaxToolKit手风琴外面,效果很好,但是我需要将转发器放在手风琴里面。 I am accessing the inner repeater (from code-behind) by placing an outer repeater outside of my Ajax Accordion. 我通过在Ajax手风琴外面放置一个外部中继器来访问内部中继器(从后面的代码)。 However, I'm still getting an error: 但是,我仍然遇到错误:

Type 'System.Web.UI.WebControls.Repeater' does not have a public property named 'Accordion'. 类型“ System.Web.UI.WebControls.Repeater”没有名为“ Accordion”的公共属性。

Here is my asp.net webform: 这是我的asp.net网络表单:

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<asp:Repeater ID="RepeaterOutside" runat="server">
<ajaxToolkit:Accordion ID="Accordion1" runat="server" HeaderCssClass="accordion" ContentCssClass="accordion" HeaderSelectedCssClass="accordion" FadeTransitions="true" TransitionDuration="500" AutoSize="None" SelectedIndex="-1" RequireOpenedPane="false">
    <Panes>
        <ajaxToolkit:AccordionPane ID="AccordionPane1" runat="server">
            <Header>
                <p>Click selection for details.</p>
                <div class="panel panel-default">
                    <div class="alertHeading" style="color: red; background-color: lightgray; font-weight: 700; padding: 1em; border-radius: 5px; border: dashed 1px; border-color: black;">ACCOUNT DETAILS</div>
                </div>
            </Header>
            <Content>
                <div id="titleAccountResults" runat="server" visible="true">
                    <div class="form-group">
                        <h6>Account Details:</h6>
                    </div>
                </div>

                <asp:DataList ID="DataListAccount" runat="server">
                    <ItemTemplate>

                        <tr>
                            <td style="width: 171px">Account Number:</td>
                            <td style="width: 220px">
                                <asp:Label ID="lblAccountNumber" runat="server" Text='<%# Eval("ACCOUNT_NUMBER") %>'></asp:Label>
                            </td>
                        </tr>
                        <asp:PlaceHolder ID="PlaceHolder36" runat="server" Visible='<%# !string.IsNullOrEmpty(Eval("ACCOUNT_STATUS").ToString()) ? true : false %>'>
                            <tr id="rowAccountStatusAccount">
                                <td style="width: 171px">Account Status:</td>
                                <td style="width: 220px">
                                    <asp:Label ID="lblAccountStatus" runat="server" Text='<%# Eval("ACCOUNT_STATUS") %>'></asp:Label>
                                </td>
                            </tr>
                        </asp:PlaceHolder>
                        <asp:PlaceHolder ID="PlaceHolder35" runat="server" Visible='<%# !string.IsNullOrEmpty(Eval("ACCOUNT_NAME").ToString()) ? true : false %>'>
                            <tr id="rowAccountNameAccount" runat="server">
                                <td style="width: 171px">Account Name:</td>
                                <td style="width: 220px">
                                    <asp:Label ID="lblAccountName" runat="server" Text='<%# Eval("ACCOUNT_NAME") %>'></asp:Label>
                                </td>
                            </tr>
                        </asp:PlaceHolder>

                    </ItemTemplate>
                </asp:DataList>

            </Content>
        </ajaxToolkit:AccordionPane>
    </Panes>
    <HeaderTemplate>
        <hr />
    </HeaderTemplate>
    <Panes>
        <ajaxToolkit:AccordionPane ID="AccordionPane2" runat="server">
            <Header>
                <div class="panel panel-default">
                    <div class="alertHeading" style="color: red; background-color: lightgray; font-weight: 700; padding: 1em; border-radius: 5px; border: dashed 1px; border-color: black;">PAYMENT DETAILS</div>
                </div>
            </Header>
            <Content>
                <div id="Div1" runat="server" visible="true">
                    <div class="form-group">
                        <h6>Contact Details:</h6>
                    </div>
                </div>

                <asp:DataList ID="DataListContact" runat="server">
                    <ItemTemplate>

                        <tr>
                            <td style="width: 171px">Account Number:</td>
                            <td style="width: 220px">
                                <asp:Label ID="lblAccountNumber" runat="server" Text='<%# Eval("ACCOUNT_NUMBER") %>'></asp:Label>
                            </td>
                        </tr>
                        <asp:PlaceHolder ID="" runat="server" Visible='<%# !string.IsNullOrEmpty(Eval("COMPANY_NAME").ToString()) ? true : false %>'>
                            <tr>
                                <td style="width: 171px">Company Name:</td>
                                <td style="width: 220px">
                                    <asp:Label ID="lblCompanyName" runat="server" Text='<%# Eval("COMPANY_NAME") %>'></asp:Label>
                                </td>
                            </tr>
                        </asp:PlaceHolder>
                        <asp:PlaceHolder ID="" runat="server" Visible='<%# !string.IsNullOrEmpty(Eval("COMPANY_ADDRESS").ToString()) ? true : false %>'>
                            <tr>
                                <td style="width: 171px">Address:</td>
                                <td style="width: 220px">
                                    <asp:Label ID="" runat="server" Text='<%# Eval("COMPANY_ADDRESS") %>'></asp:Label>
                                </td>
                            </tr>
                        </asp:PlaceHolder>
                        <asp:Repeater ID="rptPager" runat="server">
                            <ItemTemplate>
                                <asp:Button ID="lnkPage" class="btn btn-outline-primary" runat="server" Text='<%#Eval("Text") %>' CommandArgument='<%# Eval("Value") %>'
                                    CssClass='<%# Convert.ToBoolean(Eval("Enabled")) ? "page_enabled" : "page_disabled" %>'
                                    OnClick="Page_Changed" OnClientClick='<%# !Convert.ToBoolean(Eval("Enabled")) ? "return false;" : "" %>'></asp:Button>
                            </ItemTemplate>
                        </asp:Repeater>
                    </ItemTemplate>
                </asp:DataList>
            </Content>
        </ajaxToolkit:AccordionPane>
    </Panes>
</ajaxToolkit:Accordion></asp:Repeater></asp:Content>

I found the solution. 我找到了解决方案。 Place the repeater inside separate content tags and within the accordion's content tags. 将转发器放在单独的内容标签内和手风琴的内容标签内。 Also, no need to call the repeater by an outside repeater through code behind as stated above. 同样,也不需要外部中继器通过上述后面的代码调用中继器。 I removed the outside repeater. 我卸下了外部中继器。 It's working now. 现在正在工作。

<content>repeater goes here</content> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM