0

我最近根据本教程做了一个嵌套中继器。同样的事情

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

但我添加了一个 jQuery 手风琴,就像这个例子一样:

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

一切都很好,但我意识到一些 UI 问题。我的意思是,例如,如果我的一个嵌套中继器有 100 条记录,而另一个只有 1 条记录,那么这一秒只有 1 条记录,它保留了一个空白空间,因为它也有 100 条记录。有人知道如何将每个嵌套中继器的高度与其元素相匹配吗?

<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>
4

1 回答 1

0

我知道了!我找到了这个解决方案!

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

我需要将其指定为属性,仅此而已!

于 2013-08-08T13:09:10.417 回答