2013-10-21 95 views
1

這可能是一個愚蠢的問題,但我有一個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> 

回答

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>