zoukankan      html  css  js  c++  java
  • Repeater控件绑定SqlDataReader数据源

    C#源码

    string SqlConString = "Data Source=(local);Initial Catalog=FTPData;Integrated Security=True";
    SqlConnection con = new SqlConnection(SqlConString);
    con.Open();
    SqlCommand cmd = new SqlCommand(CreateSQLQueryString(), con);
    SqlDataReader dr = cmd.ExecuteReader();
    RepeaterResult.DataSource = dr;
    RepeaterResult.DataBind();
    dr.Close();
    con.Close(); 

    aspx文件中

    <asp:Repeater ID="RepeaterResult" runat="server" onitemdatabound="RepeaterResult_ItemDataBound">
        <HeaderTemplate>
            <table>
        </HeaderTemplate>
        <ItemTemplate>
            <tr><td width="100%" colspan="2"><a class="result_filename"><%#HilghtKeyWord(Eval("Filename").ToString())%></a></td></tr>
            <tr><td width="150">文件类型:<a class="result_postfix"><%#Eval("Postfix")%></a></td>
           <
    td>大小:<a class="result_size"><%#Eval("size") %></a>KB</td></tr> <tr><td width="100%" colspan="2">来源:<a class="result_lai"><%#GetPath(Eval("FileID").ToString())%></a></td></tr> <tr><td>&nbsp;</td></tr> </ItemTemplate> <FooterTemplate>    </table> </FooterTemplate> </asp:Repeater>
  • 相关阅读:
    Python openpyxl的使用
    Python字典的遍历
    Python3元组的简介和遍历
    tableau绘制饼图
    tableau创建点位地图
    tableau绘制热力地图
    select下拉框分组使用bootstrap select
    css设置div中table水平居中
    sql server的分组排序partition by函数
    document.ready
  • 原文地址:https://www.cnblogs.com/lijingpeng/p/2476302.html
Copyright © 2011-2022 走看看