SBurris
SBurris

Reputation: 7448

Listview with the same data over several columns

I have a list that contains names.

I would like to create a listview that will display these name, three to a row.

I am unsure how to accomplish this.

Upvotes: 1

Views: 357

Answers (1)

Bruno Reis
Bruno Reis

Reputation: 37822

You should use a GroupTemplate. Here's an example from 4GuysFromRolla.com

<asp:ListView ID="ProductList1" runat="server"
   DataSourceID="ProductDataSource"
   GroupItemCount="3" ItemPlaceholderID="itemsGoHere"
   GroupPlaceholderID="groupsGoHere">

   <LayoutTemplate>
      <p>
         <asp:PlaceHolder runat="server" ID="groupsGoHere"></asp:PlaceHolder>
      </p>
   </LayoutTemplate>

   <GroupTemplate>
      <ol>
         <asp:PlaceHolder runat="server" ID="itemsGoHere"></asp:PlaceHolder>
      </ol>
   </GroupTemplate>

   <ItemTemplate>
      <li><%#Eval("ProductName")%></li>
   </ItemTemplate>
</asp:ListView> 

Upvotes: 2

Related Questions