zoukankan      html  css  js  c++  java
  • treeview 的深层添加节点

       private void SetTree()       //设置treeview 数据绑定
        {
            TreeView.Nodes.Clear();
            BM1.IBLL.IFileRgstBLL bll = BM1.Factory.BLLFactory.CreateIFileRgstBLL();
            ArrayList list = bll.GetPath(Session["CMP_ID"].ToString(), false,Session["LANGUAGE"].ToString(), 0);

            TreeNode Parent = new TreeNode("文档管理","Root");

            for (int i = 0; i < list.Count; i++ )
            {
                FileRgstVO vo = (FileRgstVO)list[i];
                if (vo.GetParent_Num == 0)
                {
                    Parent.ChildNodes.Add(new TreeNode(vo.GetPath_Name, vo.GetPath_Num.ToString()));
                    continue;
                }
                //Parent = aa(vo, Parent);
                //递归调用添加子节点
                aa(vo, Parent);
            }
            TreeView.Nodes.Add(Parent);
        }

        private bool aa(FileRgstVO vo , TreeNode treeNode)  //遍历添加子节点
        {
            if (vo.GetParent_Num.ToString() == treeNode.Value)
            {
                treeNode.ChildNodes.Add(new TreeNode(vo.GetPath_Name, vo.GetPath_Num.ToString()));
                return true;
            }
            bool flg = false;

            foreach (object obj in treeNode.ChildNodes)
            {
                TreeNode tree = (TreeNode)obj;
                if (vo.GetParent_Num.ToString() == tree.Value)
                {
                    tree.ChildNodes.Add(new TreeNode(vo.GetPath_Name, vo.GetPath_Num.ToString()));
                    flg = true;
                    break;
                }
                else
                {
                    flg = aa(vo, tree);
                    if (flg)
                        break;
                }
            }
            return flg;
        }

  • 相关阅读:
    Luogu P3919【模板】可持久化数组(可持久化线段树/平衡树)
    线段树||BZOJ5194: [Usaco2018 Feb]Snow Boots||Luogu P4269 [USACO18FEB]Snow Boots G
    线段树||BZOJ1593: [Usaco2008 Feb]Hotel 旅馆||Luogu P2894 [USACO08FEB]酒店Hotel
    CF 610E. Alphabet Permutations
    BZOJ 1227: [SDOI2009]虔诚的墓主人
    BZOJ1009: [HNOI2008]GT考试
    BZOJ3674: 可持久化并查集加强版
    BZOJ3261: 最大异或和
    BZOJ2741: 【FOTILE模拟赛】L
    BZOJ3166: [Heoi2013]Alo
  • 原文地址:https://www.cnblogs.com/hyd309/p/1292804.html
Copyright © 2011-2022 走看看