2013-08-31 108 views
0

我使用列表視圖控件打印數據。我在itemtemplate中使用了LinkBut​​ton。我希望列名不應該打印......................................... ............ 我必須做出什麼改變?Asp.net和ListView控件

<asp:ListView ID="ListView1" runat="server" DataKeyNames="userid" DataSourceID="SqlDataSource1"> 
     <AlternatingItemTemplate> 
      <tr style=""> 
       <td> 
        <asp:Label ID="catgLabel" runat="server" Text='<%# Eval("catg") %>' /> 
       </td> 
       <td> 
        <asp:Label ID="useridLabel" runat="server" Text='<%# Eval("userid") %>' /> 
       </td> 
       <td> 
        <asp:Label ID="datetimeLabel" runat="server" Text='<%# Eval("datetime") %>' /> 
       </td> 
      </tr> 
     </AlternatingItemTemplate> 
     <EditItemTemplate> 
      <tr style=""> 
       <td> 
        <asp:Button ID="UpdateButton" runat="server" CommandName="Update" Text="Update" /> 
        <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" Text="Cancel" /> 
       </td> 
       <td> 
        <asp:TextBox ID="catgTextBox" runat="server" Text='<%# Bind("catg") %>' /> 
       </td> 
       <td> 
        <asp:Label ID="useridLabel1" runat="server" Text='<%# Eval("userid") %>' /> 
       </td> 
       <td> 
        <asp:TextBox ID="datetimeTextBox" runat="server" Text='<%# Bind("datetime") %>' /> 
       </td> 
      </tr> 
     </EditItemTemplate> 
     <EmptyDataTemplate> 
      <table runat="server" style=""> 
       <tr> 
        <td>No data was returned.</td> 
       </tr> 
      </table> 
     </EmptyDataTemplate> 
     <InsertItemTemplate> 
      <tr style=""> 
       <td> 
        <asp:Button ID="InsertButton" runat="server" CommandName="Insert" Text="Insert" /> 
        <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" Text="Clear" /> 
       </td> 
       <td> 
        <asp:TextBox ID="catgTextBox" runat="server" Text='<%# Bind("catg") %>' /> 
       </td> 
       <td> 
        <asp:TextBox ID="useridTextBox" runat="server" Text='<%# Bind("userid") %>' /> 
       </td> 
       <td> 
        <asp:TextBox ID="datetimeTextBox" runat="server" Text='<%# Bind("datetime") %>' /> 
       </td> 
      </tr> 
     </InsertItemTemplate> 
     <ItemTemplate> 
      <tr style=""> 
       <td> 
        <asp:Label ID="catgLabel" runat="server" Text='<%# Eval("catg") %>' /> 
       </td> 
       <td> 
        <asp:Label ID="useridLabel" runat="server" Text='<%# Eval("userid") %>' /> 
       </td> 
       <td> 
        <asp:Label ID="datetimeLabel" runat="server" Text='<%# Eval("datetime") %>' /> 
       </td> 
      </tr> 
     </ItemTemplate> 
     <LayoutTemplate> 
      <table runat="server"> 
       <tr runat="server"> 
        <td runat="server"> 
         <table id="itemPlaceholderContainer" runat="server" border="0" style=""> 
          <tr runat="server" style=""> 
           <th runat="server">catg</th> 
           <th runat="server">userid</th> 
           <th runat="server">datetime</th> 
          </tr> 
          <tr id="itemPlaceholder" runat="server"> 
          </tr> 
         </table> 
        </td> 
       </tr> 
       <tr runat="server"> 
        <td runat="server" style=""></td> 
       </tr> 
      </table> 
     </LayoutTemplate> 
     <SelectedItemTemplate> 
      <tr style=""> 
       <td> 
        <asp:Label ID="catgLabel" runat="server" Text='<%# Eval("catg") %>' /> 
       </td> 
       <td> 
        <asp:Label ID="useridLabel" runat="server" Text='<%# Eval("userid") %>' /> 
       </td> 
       <td> 
        <asp:Label ID="datetimeLabel" runat="server" Text='<%# Eval("datetime") %>' /> 
       </td> 
      </tr> 
     </SelectedItemTemplate> 
    </asp:ListView> 
+1

顯示您的代碼.. –

+0

你能看到代碼嗎? –

+0

問題已解決:P –

回答

0

嘗試將ListView的HeaderStyle屬性設置爲None。它可以採取3個值:

a. None 
b. Nonclickable 
c. Clickable 

以下確切文本從MSDN足夠::

的HeaderStyle屬性允許您指定列標題是否可見,如果是可見的,他們是否會作爲可點擊的按鈕。如果HeaderStyle屬性設置爲ColumnHeaderStyle.None,則不顯示列標題。

讓我們知道你是否也嘗試過相同或不同的方法,請在此發佈以便對他人有所幫助。