简体   繁体   English

带有jQuery手风琴的中继器中的中继器

[英]Repeater inside a repeater with jQuery accordion

I recently did a nested repeater according to this tutorial. 最近,我根据本教程做了一个嵌套转发器。 The same thing 一样的东西

http://www.codeproject.com/Articles/6140/A-quick-guide-to-using-nested-repeaters-in-ASP-NET http://www.codeproject.com/Articles/6140/A-quick-guide-to-using-nested-repeaters-in-ASP-NET

But I added a jQuery accordion just like this example: 但是我像下面的示例一样添加了一个jQuery手风琴:

http://www.snyderplace.com/demos/accordion.html http://www.snyderplace.com/demos/accordion.html

Everything is good, but I realized some UI issues. 一切都很好,但是我意识到了一些UI问题。 I mean for example if one of my nested repeaters has 100 records and another has just 1 record, for this second with just 1 record, it has a blank space reserved as it had 100 records also. 我的意思是,例如,如果我的一个嵌套转发器有100条记录,而另一个只有1条记录,对于第二个只有1条记录,则它保留了空白,因为它也有100条记录。 Someone knows how to fit the height each nested repeater to its elements? 有人知道如何使每个嵌套中继器的高度适合其元素吗?

<div id="accordion">
    <asp:Repeater ID="summary" runat="server" OnItemDataBound="summary_ItemDataBound">
        <HeaderTemplate>
        </HeaderTemplate>
        <ItemTemplate>
            <div>
                Id:<asp:Literal ID="litCategory" runat="server" />
            </div>
            <div>
                <asp:Repeater ID="detail" runat="server" OnItemDataBound="detail_ItemDataBound">
                <HeaderTemplate>
                    <table>
                        <thead>
                            <tr>
                                <th>ID</th>
                                <th>Name</th>
                            </tr>
                        </thead>
                        <tbody>
                </HeaderTemplate>
                <ItemTemplate>
                        <tr>
                            <td><asp:Literal ID="litID" runat="server" /></td>
                            <td><asp:Literal ID="litName" runat="server" /></td>
                        </tr>
                </ItemTemplate>
                <FooterTemplate>
                        </tbody>
                    </table>
                </FooterTemplate>
            </asp:Repeater>
            </div>
        </ItemTemplate>
        <FooterTemplate>
        </FooterTemplate>
    </asp:Repeater>
</div>

I got it! 我知道了! I found this solution! 我找到了这个解决方案!

    $(function () {
        $("#accordion").accordion({
            collapsible: true,
            heightStyle: "content"
        });
    });

I need to specify that to attributes and that's it! 我需要将其指定为属性,仅此而已!

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

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