zoukankan      html  css  js  c++  java
  • 子级Repeater获取父级Repeater绑定项的值

    1.子级Repeater中绑定父级的某个字段:

    <%# DataBinder.Eval((Container.NamingContainer.NamingContainer as RepeaterItem).DataItem, "ModuleName") %>

    2.在子级Repeater中引用父级某个控件的值:

    <%# ((Label)((RepeaterItem)((Repeater)(((RepeaterItem)Container).NamingContainer)).NamingContainer).FindControl("moduleID")).Value %>

    <asp:Repeater ID="Repeater1" runat="server"> 
         
    <ItemTemplate> 
            OrderID: 
    <%# Eval("OrderID")%>
            CustomerID : 
             
    <asp:Label ID="Label1" runat="server" Text='<%#Eval("CustomerID")%>'></asp:Label> <br />
            
    <asp:Repeater ID="Repeater2" runat="server" DataSource='<%# GetOrderDetails(Convert.ToInt32(Eval("OrderID"))) %>'> 
                
    <ItemTemplate>  
                    
    &nbsp;&nbsp;
                    子容器得到CustomerID : 
    <%# ((Label)((RepeaterItem)((Repeater)(((RepeaterItem)Container).NamingContainer)).NamingContainer).FindControl("Label1")).Text %> 
                    UnitPrice: 
    <%#Eval("UnitPrice")%> <br />
                
    </ItemTemplate> 
            
    </asp:Repeater> 
            
    <br />                 
         
    </ItemTemplate> 
    </asp:Repeater>

  • 相关阅读:
    Jquery easyui中的有效性检查
    当执行批量删除时
    nested exception is com.mysql.jdbc.PacketTooBigException: Packet for query is too large (1044 > 1024
    java的四种取整方法
    springmvc乱码解决
    跨域
    垂直居中
    js判断数组
    安装 node-sass 的正确姿势
    js判断qq浏览器
  • 原文地址:https://www.cnblogs.com/ANDY_ZHANG/p/2497626.html
Copyright © 2011-2022 走看看