views:

38

answers:

1

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.

+2  A: 

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>
Bruno Reis