没有中继器的Datalist

时间:2014-05-01 12:10:01

标签: c# asp.net .net

我是asp.net的新人。我创建了一个包含datalist的表,其中包含来自数据库的信息。问题是每个行都会重复表。我有像行数据一样的表格。我不想要这个,我只想要一个包含所有行的表 我怎么能这样做?

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="DataList.aspx.cs" Inherits="DataList" MasterPageFile="~/MasterPage2.master" %>

<asp:Content ID="content1" ContentPlaceholderID="ContentPlaceHolder2" runat="server">
    <asp:DataList ID="datalist1" runat="server" 
        onitemcommand="Datalist1_ItemCommand"  
        oneditcommand="Datalist1_EditCommand" oncancelcommand="datalist1_CancelCommand" 
        onupdatecommand="datalist1_UpdateCommand">
        <ItemTemplate>      
        <article class="module width_12_quarter">
        <header><h3 class="tabs_involved">Artikujt</h3>
        </header>
        <div class="tab_container">
            <div id="tab1" class="tab_content">
            <table class="tablesorter" cellspacing="0"> 
                <thead>
                <tr>
                    <th>Id</th>
                    <th>Tema</th>            
                    <th>Keywords</th>
                    <th>Kategoria</th>
                    <th>Departamenti</th>
                <tr> 
                </thead>
                <tbody>
                <tr>
                    <td><asp:Label ID="lblId" runat="server" Text='<%#Bind("Id") %>'></asp:Label></td>
                    <td><asp:Label ID="lblTema" runat="server" Text='<%#Bind("Tema") %>'></asp:Label></td>
                    <td><asp:Label ID="LabelKeywords" runat="server" Text='<%#Bind("Keywords") %>'></asp:Label></td>
                    <td><asp:Label ID="LabelKategoria" runat="server" Text='<%#Bind("Kategoria_Id") %>'></asp:Label></td>
                    <td><asp:Label ID="Label1" runat="server" Text='<%#Bind("Departamenti_Id") %>'></asp:Label></td>
                    <td><asp:Button ID="btnEdit" runat="server" CommandName="Edit" Text="Edit"/></td>
                    <td><asp:Button ID="btnDelete" runat="server" CommandName="Delete" Text="Delete"/></td>
                </tr> 
                </tbody>  
            </table>
            </div>
            </div>
            </article>
        </ItemTemplate>
<EditItemTemplate>
    <article class="module width_3_quarter">
        <header><h3 class="tabs_involved">Artikujt</h3>
        </header>
        <div class="tab_container">
            <div id="tab1" class="tab_content">
            <table class="tablesorter" cellspacing="0"> 
                <thead>
                <tr>
                    <th>Id</th>
                    <th>Tema</th>            
                    <th>Keywords</th>
                    <th>Kategoria</th>
                    <th>Departamenti</th>
                <tr> 
                </thead>
                <tbody>
                <tr>
                    <td><asp:TextBox ID="etxtId" runat="server" Text='<%#Bind("Id") %>'></asp:TextBox></td>
                    <td><asp:TextBox ID="etxtTema" runat="server" Text='<%#Bind("Tema") %>'></asp:TextBox></td>
                   <td><asp:TextBox ID="etxtKeywords" runat="server" Text='<%#Bind("Keywords") %>'></asp:TextBox></td>
                    <td><asp:TextBox ID="etxtKategoria" runat="server" Text='<%#Bind("Kategoria_Id") %>'></asp:TextBox></td>
                    <td><asp:TextBox ID="etxtDepartamenti" runat="server" Text='<%#Bind("Departamenti_Id") %>'></asp:TextBox></td>
                    <td><asp:Button ID="btnUpdate" runat="server" CommandName="Update" Text="Update"/></td>           
                    <td><asp:Button ID="btnCancel" runat="server" CommandName="Cancel" Text="Cancel"/></td>      
                </tr>
                </tbody>  
            </table>
            </div>
            </div>
            </article>
</EditItemTemplate>
    </asp:DataList>
    </asp:Content>

0 个答案:

没有答案