zoukankan      html  css  js  c++  java
  • [转载]Repeater三层嵌套

    两层嵌套

     protected  void  rpt_ItemDataBound(object  sender,  RepeaterItemEventArgs  e)

       if   (e.Item.ItemType   ==   ListItemType.Item   ||   e.Item.ItemType   ==   ListItemType.AlternatingItem) 
         { 
            Repeater   rpt   =   (Repeater)e.Item.FindContro( "rpt_Level04 "); 
            int   typeFatherID   =   ((CommonType)e.Item.DataItem).TypeID; 
            rpt.DataSource   =   da.GetAllNodeInfo(tt,   typeFatherID); 
            rpt.DataBind(); 
         }
    }

    三层嵌套

    protected  void  rpt_Level02_ItemDataBound(object  sender,  RepeaterItemEventArgs  e)

            if   (e.Item.ItemType   ==   ListItemType.Item   ||   e.Item.ItemType    ==ListItemType.AlternatingItem) 
         { 
            Repeater   rpt   =   (Repeater)e.Item.FindControl( "rpt_Level03 "); 

    //给下一层repeater绑定事件
          rpt.ItemDataBound   +=   new   RepeaterItemEventHandler(rpt_ItemDataBound);// <==这里是关键 
            int   typeFatherID   =   ((CommonType)e.Item.DataItem).TypeID; 
            rpt.DataSource   =   da.GetAllNodeInfo(tt,   typeFatherID); 
            rpt.DataBind(); 
         } 


    protected   void   rpt_ItemDataBound(object   sender,   RepeaterItemEventArgs   e)

         if   (e.Item.ItemType   ==   ListItemType.Item   ||   e.Item.ItemType   ==   ListItemType.AlternatingItem) 
           { 
            Repeater   rpt   =   (Repeater)e.Item.FindControl( "rpt_Level04 "); 
            int   typeFatherID   =   ((CommonType)e.Item.DataItem).TypeID; 
            rpt.DataSource   =   da.GetAllNodeInfo(tt,   typeFatherID); 
            rpt.DataBind(); 
            }
    }

  • 相关阅读:
    SQLSERVER 的表分区(水平) 操作记录2
    GraphQl in ASP.NET Core
    初始认知学习 .net core 逐步加深
    C# 关于使用JavaScriptSerializer 序列化与返序列化的操作
    Nginx、IIS 相关命令
    SqlServer:查询指定表所有外键关联表信息
    centos 重启宝塔命令
    c# 根据日志中的方法信息,反射再次执行相关方法
    jackson 下载地址记录
    【设计模式】六大原则
  • 原文地址:https://www.cnblogs.com/280850911/p/2235061.html
Copyright © 2011-2022 走看看