zoukankan      html  css  js  c++  java
  • DataList嵌套

    弄了一天,终于搞定
    正确代码如下:
    aspx代码如下:  最主要的是看子DataList的DataSource事件的绑定
    <asp:DataList id="provincelist" runat="server" Width="770px">
        <ItemTemplate>
         <table width="770">
          <tr>
           <td height="31"><table width="100%" border="0" cellspacing="0" cellpadding="0">
             <tr>
              <td width="2%" height="30"><div align="right"><img src="images/c_04_ico.gif" width="24" height="24" /></div>
              </td>
              <td width="98%" class="la13">&nbsp;<a href='prolist.aspx?pro_id=<%# DataBinder.Eval(Container.DataItem,"provinceid") %>' class="la13" target=_blank>
                <%# DataBinder.Eval(Container.DataItem,"provincename") %>
               </a>
              </td>
             </tr>
            </table>
           </td>
          </tr>
          <tr>
           <td height="27">
           <asp:DataList id="citylist" runat="server" DataSource='<%# Getprovinceid(Convert.ToInt32(DataBinder.Eval(Container.DataItem, "provinceid"))) %>' RepeatColumns="50" RepeatDirection="Horizontal"
           RepeatLayout="Flow" Width="98%">
           <ItemTemplate>
           ·<a href='province_1_18.html' title='澳门市大堂区' class="h"><%# DataBinder.Eval(Container.DataItem,"cityname") %></a> &nbsp;&nbsp;
           </ItemTemplate>
           </asp:DataList>
           </td>
          </tr>
         </table>
        </ItemTemplate>
       </asp:DataList>

    后台代码:
      public DataView Getprovinceid(int provinceid)
      {
       DataSet qDs = qDAO.liebiaolist("add_city","cityid",provinceid,"provinceid");
       return qDs.Tables[0].DefaultView;
      }
  • 相关阅读:
    python 3.5.2安装mysql驱动报错
    mysql创建用户
    Centos7 修改SSH 端口
    centos 7 升级后yum install出现Exiting on user cancel
    centos7 systemctl 启动 Redis 失败
    redis 异常解决办法
    用普通用户通过sudo进行启动tomcat时报如下异常
    svn迁移到git仓库并保留commit历史记录
    CentOS更新yum源
    django 添加comments app
  • 原文地址:https://www.cnblogs.com/yzwdli/p/874017.html
Copyright © 2011-2022 走看看