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>
  • 相关阅读:
    framework7 底部弹层popup js关闭方法
    div动画旋转效果
    面试题3
    面试题2
    CORS跨域请求[简单请求与复杂请求]
    面试题1
    nginx
    Pycharm配置支持vue语法
    Ajax在jQuery中的应用---加载异步数据
    jQuery开发入门
  • 原文地址:https://www.cnblogs.com/lijingpeng/p/2476302.html
Copyright © 2011-2022 走看看