zoukankan      html  css  js  c++  java
  • DataList实现绑定数据的横向排列[转]

    DataList及repeater都可以实现绑定数据的横向排列:      

    <table><tr><td>
           <asp:DataList ID="DataList1" runat="server" RepeatDirection="Horizontal" RepeatColumns="5">
            <ItemTemplate>                      
              <a href='show.aspx?ipath=file://202.114.32.172/Files/<%# DataBinder.Eval(Container.DataItem, "sid") %>' target="_blank">
                    <%# DataBinder.Eval(Container.DataItem, "sid") %>
                </a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
             </ItemTemplate>
            </asp:DataList>
           </td></tr></table>

     数据绑定:

            string sql = "";
            sql = "...";
            MySqlDataAdapter da = new MySqlDataAdapter(sql, conn);
            conn.Open();
            DataSet ds = new DataSet();
            da.Fill(ds);        
            DataList1.DataSource = ds.Tables[0].DefaultView

            DataList1.DataBind();//2008-10-07

    竖着显示的(默认的显示方式):

                <asp:DataList ID="MyList" RepeatColumns="1" runat="server" Width="582px" HorizontalAlign="Center" >

                    <ItemTemplate>
                        <table border="0" width="400" align=center>
                              <tr>
                                <td width="25%">
                                    <%# DataBinder.Eval(Container.DataItem, "IID") %>
                                </td>
                                <td width="35%">
                                    <a href='show.aspx?ipath=<%# DataBinder.Eval(Container.DataItem, "IPATH") %>'>
                                        <%# DataBinder.Eval(Container.DataItem, "INAME") %>
                                    </a>
                                </td>
                                <td width="40%" valign="middle" >
                                    <a href='show.aspx?ipath=<%# DataBinder.Eval(Container.DataItem, "IPATH") %>'>
                                        <img src='<%# DataBinder.Eval(Container.DataItem, "IPATH") %>' width="100" height="75"
                                            border="0">
                                    </a>
                                </td>
                            </tr>
                        </table>
                    </ItemTemplate>
                </asp:DataList>

  • 相关阅读:
    linux下文件的复制、移动与删除
    Hbase万亿级存储性能优化总结-配置
    hbase 读写和优化
    hive数据倾斜定位及处理
    flink初识及安装flink standalone集群
    【Linux】用less查看日志文件
    sqoop的详细使用及原理
    HBase删除数据的原理
    hbase数据加盐(Salting)存储与协处理器查询数据的方法
    Hbase内存磁盘大致关系
  • 原文地址:https://www.cnblogs.com/flyrain/p/datalist.html
Copyright © 2011-2022 走看看