开发者

Changing the item orientation of a listview, datagrid, datalist or any other databound control?

I have data that renders in a listview like this:

name address city

Tom 200 George Street Sydney

i would like it to render like this:

name Tom

address 200 George S开发者_运维技巧treet

city sydney

Any suggestions on how I may do this?


There are many ways to do this. The implementations for ListView, DataList, and Repeater would be similar, but you could do something like this:

<asp:ListView ID="ListView1" runat="server">
    <ItemTemplate>
        <div style="border:1px solid #ccc;padding:10px;margin:3px;">
            <table cellpadding="3" cellspacing="0">
            <tr>
                <td>Name:</td>
                <td><%#Eval("Name")%></td>
            </tr>
            <tr>
                <td>Address:</td>
                <td><%#Eval("Address")%></td>
            </tr>
            </table>
        </div>
    </ItemTemplate>
</asp:ListView>
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜