1

When I bind a list to my Repeater, it shows all the items in the list vertically.

Is it possible to show it horizontal?

Thanks

EDIT: I think I need to use HTML which I read from the comments.

Swag
  • 2,090
  • 9
  • 33
  • 63
  • 1
    Please provide more information. Repeaters just render whatever HTML you give it - it doesn't design anything for you. So if it's not doing what you want, then your HTML is the problem and can be looked at. – Joe Enos Jul 29 '13 at 18:22
  • @JoeEnos is quite right - depending onr your html you should be able to acheive what you want by changing your markup and/or adding some CSS classes – Luke Baughan Jul 29 '13 at 18:24
  • Ooh so I need to put some html in the repeater what makes it horizontal? – Swag Jul 29 '13 at 18:24
  • Search for "CSS horizonatal div" (or wahtever tag your repeater's code generates for each row). I.e. possible duplicate of [CSS - Make divs align horizontally](http://stackoverflow.com/questions/37103/css-make-divs-align-horizontally) – Alexei Levenkov Jul 29 '13 at 18:26

3 Answers3

2

An alternative to the ASP.NET Repeater control is to use an ASP.NET DataList control, like this:

<asp:DataList ID="dlContacts" runat="server" RepeatLayout="Table" RepeatColumns="2" CellPadding="2" CellSpacing="2">
    <ItemTemplate>
        // Put your markup structure here
        <table>
            <tr>
                <td colspan="2">
                </td>
            </tr>
        </table>
    </ItemTemplate>
</asp:DataList>

Read ASP.NET DataList Rolodex for an example of how to implement this.

Karl Anderson
  • 34,606
  • 12
  • 65
  • 80
1

YEs you can.

on each element , wrap it / or apply to it a float style (float:left) or make it inline style and it will align left automatically :

Royi Namir
  • 144,742
  • 138
  • 468
  • 792
0

Out of the box, the Repeater control does not allow you to set the RepeatDirection. You can either use a DataList, which does have such property (RepeatDirection) or use CSS to make sure that elements render horizontally first until they fill the available width and then continue to the next row.

Icarus
  • 63,293
  • 14
  • 100
  • 115