<%# Eval("Login"); %> <%# Eval("Login"); %> <%# Eval("Login"); %>

ASP.net Datalist Items in single row?

4.2k views Asked by At

I want to list Datalist-Items in one Line, tried it like that:

  <asp:DataList ID="DataList1" runat="server">
                <ItemTemplate>
                    <%# Eval("Login"); %> 
                </ItemTemplate>
            </asp:DataList>

(Edited Code for better readability, that is why there is no DataSource etc, but this works fine anyways)

But it keeps writing each element in one single line.

How can I get Value1, Value2, Value3 in one line?

Help is very apreciated :) Thanks in advance for every tip,

Harry

3

There are 3 answers

0
James Johnson On BEST ANSWER

Try this:

<asp:DataList ID="DataList1" runat="server" RepeatDirection="Horizontal" RepeatColumns="5" RepeatLayout="Table" ..>

You can adjust the number of columns to repeat across, and the layout.

0
Davide Piras On

you have to set the property: RepeatDirection to horizontal.

see here: DataList.RepeatDirection Property

0
user3651366 On
<asp:DataList ID="DataList1" runat="server" RepeatColumns="3" RepeatDirection="Horizontal" >

Using the code above you can display the desired column's data in 3 columns.

Using you can also arrange this data in table view in your markup part of the source code.

You can adjust just by right click on DATALIST select Properties and Goto LAYOUT ...

Select Repeat Column Property, And Set it to 1 for showing your data in one row..