这可能是一个愚蠢的问题,但我有一个ListView
,可以像这样在一行中显示数据
Name Address Phone
我想要的是像这样垂直显示数据
Name
Address
Phone
我需要做些什么才能实现这个目标?
<asp:ListView ID="ListView1" runat="server" >
<ItemTemplate>
<tr id="tbl1" runat="server">
<td><%# Eval("name")%></td>
<td><%# Eval("address")%></td>
<td><%# Eval("phone")%></td>
</tr>
</ItemTemplate>
<LayoutTemplate>
<table id="tbl1" runat="server">
<tr id="tr1" runat="server">
<td id="td1" runat="server">name</td>
</tr>
<tr id="tr2" runat="server">
<td id="td2" runat="server">address</td>
</tr>
<tr id="tr3" runat="server">
<td id="td3" runat="server">phone</td>
</tr>
<tr id="ItemPlaceholder" runat="server">
</tr>
</table>
</LayoutTemplate>
</asp:ListView>
答案 0 :(得分:2)
<asp:ListView ID="ListView1" runat="server" >
<LayoutTemplate>
<asp:PlaceHolder ID="itemPlaceholder" runat="server"></asp:PlaceHolder>
</LayoutTemplate>
<ItemTemplate>
<table>
<tr>
<td><%# Eval("name") %></td>
</tr>
<tr>
<td><%# Eval("address") %></td>
</tr>
<tr>
<td><%# Eval("phone") %></td>
</tr>
</table>
</ItemTemplate>
</asp:ListView>