0

我正在尝试对 ListView 项目(每行 2 个)进行分组,但我无法使其工作。这就是我正在使用的:

<asp:ListView ID="BookListView" runat="server" DataSourceID="SqlDataSource1" 
    onselectedindexchanged="BookListView_SelectedIndexChanged" GroupItemCount="2">

    <LayoutTemplate>
        <div>
             <div ID="groupPlaceholder" runat="server">

             </div>
             <div  style="text-align:center" runat="server">
                <asp:DataPager ID="DataPager1" runat="server">
                    ...........
                </asp:DataPager>
             </div>
        </div>
    </LayoutTemplate>

    <GroupTemplate>
            <div ID="itemPlaceholder" class="GroupTemplateContainerDiv" runat="server" style="clear:both">
            </div>
    </GroupTemplate>

    <ItemTemplate>
         <div class="ItemTemplateContainerDiv">
            <div class="itemTemplateleftColumn">
                ..........
            </div>
            <div class="itemTemplaterightColumn">
                ..........  
            </div>
        </div>
    </ItemTemplate>

</asp:ListView>

除分组部分外,一切正常。有任何想法吗?提前致谢

4

1 回答 1

1

尝试使用 aPlaceHolder而不是 div:

<LayoutTemplate>
    <div>
         <asp:PlaceHolder runat="server" ID="groupPlaceholder" />

         <div  style="text-align:center" runat="server">
            <asp:DataPager ID="DataPager1" runat="server">
                ...........
            </asp:DataPager>
         </div>
    </div>
</LayoutTemplate>

<GroupTemplate>
        <div class="GroupTemplateContainerDiv" style="clear:both">
            <asp:PlaceHolder runat="server" ID="itemPlaceholder" />
        </div>
</GroupTemplate>
于 2013-07-30T14:34:25.850 回答