当前位置:编程学习 > C#/ASP.NET >>

各位高手请教:关于datalist控件嵌套_传递数据

目的主要实现子级的datalist中linkbutton控件根据父级datalist中linkbutton中的text值从表里查询
<asp:DataList ID="DataList1" runat="server" RepeatDirection="Horizontal">
    <ItemTemplate>
<li><span class="v"><asp:LinkButton ID="LinkButton1" runat="server" Text='<%# Eval("title_name") %>       OnClick="LinkButton1_Click" OnCommand="LinkButton1_Command" ></asp:LinkButton></span> 
     <div class="kind_menu" style="left: 40px">
       <asp:DataListID="DataList2"runat="server"RepeatDirection="Horizontal"DataSourceID="SqlDataSource1"   >
           <ItemTemplate>
              <asp:LinkButton ID="LinkButton2" runat="server" Text='<%# Eval("s_title_name") %>'           CommandArgument='<%# Eval("title_id") %>'></asp:LinkButton>
           </ItemTemplate>
       </asp:DataList>
          </div>
                 </li> 
      </ItemTemplate>
</asp:DataList>
//父级datalist是用
        dt = db.sel("select * from t_navigation");
        DataList1.DataSource = dt.DefaultView;
        DataList1.DataBind();
//子级datalist是用
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:jrxConnectionString %>"
SelectCommand="SELECT * FROM [t_s_navigation] WHERE ([title_id] = “这里如何获取父级datalist中控件的值”)">
      
</asp:SqlDataSource> --------------------编程问答-------------------- http://blog.csdn.net/vip__888/archive/2010/01/05/5138288.aspx --------------------编程问答-------------------- 百度 DataList嵌套
补充:.NET技术 ,  ASP.NET
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,