zoukankan      html  css  js  c++  java
  • 无限数据递归

    protected void Page_Load(object sender, EventArgs e)
            {
                if (!Page.IsPostBack)
                {
                  AddTree(0, (TreeNode)null);
                }
            }
            protected void AddTree(int parentId, TreeNode pNode)
            {

                PurviewPage[] purviewPageList = BLL.PurviewPageBLL.GetDataByParentId(parentId);
                for(int i=0;i<purviewPageList.Length;i++)
                {
                    TreeNode Node = new TreeNode();
                    if (pNode == null)
                    {
                        //添加根节点
                        Node.Text = purviewPageList[i].Name;
                        Node.Value = purviewPageList[i].ID.ToString() ;
                        Node.NavigateUrl = Request.Url.AbsoluteUri.Replace(BLL.PurviewPageBLL.getUrl(Request.RawUrl), "") + purviewPageList[i].Url;
                        TreeView1.Nodes.Add(Node);
                        Node.Expanded = true;
                        AddTree(purviewPageList[i].ID, Node); //再次递归
                    }
                    else
                    {
                        //?添加当前节点的子节点
                        Node.Text = purviewPageList[i].Name;
                        Node.Value = purviewPageList[i].ID.ToString();
                        Node.NavigateUrl = Request.Url.AbsoluteUri.Replace(BLL.PurviewPageBLL.getUrl(Request.RawUrl), "") + purviewPageList[i].Url;
                        pNode.ChildNodes.Add(Node);
                        Node.Expanded = true;
                        AddTree(purviewPageList[i].ID, Node); //再次递归
                    }
                }
            }

  • 相关阅读:
    好文推荐
    高效词频分析
    内网渗透技巧:判断机器真实外网IP的5种方法总结
    禁用substr、substring、mid函数的sql注入脚本
    内网文件传输
    工作
    我是如何逃过所有杀软进行内网端口转发的
    扎克伯格开发的家用AI: Jarvis
    Python初学者之网络爬虫(二)
    Python初学者之网络爬虫
  • 原文地址:https://www.cnblogs.com/skyblue/p/955027.html
Copyright © 2011-2022 走看看