开发者

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

开发者 https://www.devze.com 2023-04-10 10:18 出处:网络
I have data that renders in a listview like this: name addresscity Tom200 George Street Sydney i would like it to render like this:

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

精彩评论

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

关注公众号