I am trying to group ListView items (2 per row) but I can't make it work. This is what I am using:
<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>
Everything works fine except from the grouping part. Any ideas? Thanks in advance
Try using a PlaceHolder
instead of divs:
<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>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.