Repeater控件

        <asp:Repeater ID="rpt1" runat="server">
            <HeaderTemplate>
                   <table>
                <tr>
                    <td>ID</td>
                    <tb>次数</tb>
                </tr>

            </HeaderTemplate>
            <ItemTemplate>
                <tr>
                    <td><%# Eval("A") %></td>
                    <td><%# Eval("B") %></td>
                </tr>
            </ItemTemplate>
            <FooterTemplate>
            </table>
            </FooterTemplate>
        </asp:Repeater>

    protected void Button1_Click(object sender, EventArgs e)
    {
        string sql = "select * from Table_1";
        DataTable dt = SqlHelper.ExecuteDatatable(sql);
        rpt1.DataSource = dt;
        rpt1.DataBind();
    }

 

 

posted @ 2017-11-20 08:51  enych  阅读(187)  评论(0编辑  收藏  举报