Question

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

Was it helpful?

Solution

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.

OTHER TIPS

you have to set the property: RepeatDirection to horizontal.

see here: DataList.RepeatDirection Property

<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..

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top