开发者

ASP.net Datalist Items in single row?

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

  <asp:DataList ID="DataList1" runat="server">
                <ItemTemplate>
                    <%# Eval("Login"); %> 
    开发者_JS百科            </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


you have to set the property: RepeatDirection to horizontal.

see here: DataList.RepeatDirection Property


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜