zoukankan      html  css  js  c++  java
  • 20161011001 treeView 递归

    protected void FillTree()
            {
                H_data H_data = new H_data();

                H_data.sql_text1 = " select [FID],[N_Name],[N_Parent_ID] FROM [PLM].[dbo].[T_Sys_File_Tree] ";
                H_data.select_tables();
                DataSet1 = H_data.DataSet8;
                DataTable dt = DataSet1.Tables[0];
                //this.dataGridView1.DataSource = dt;

                NodeLoad(0, null);
            }
            private void NodeLoad(int parentId, TreeNode upNode)
            {
                DataView dv = new DataView(DataSet1.Tables[0]);
                dv.RowFilter = string.Format("N_Parent_ID = {0}", parentId);
                foreach (DataRowView drv in dv)
                {
                    if (upNode == null)
                    {
                        TreeNode newNode = this.treeView1.Nodes.Add(drv[1].ToString());
                        newNode.Tag = drv[0].ToString();
                        NodeLoad(Int32.Parse(drv[0].ToString()), newNode);
                        newNode.Expand();
                    }
                    else
                    {
                        TreeNode newNode = upNode.Nodes.Add(drv[1].ToString());
                        newNode.Tag = drv[0].ToString();
                        NodeLoad(Int32.Parse(drv[0].ToString()), newNode);
                        newNode.Expand();
                    }
                }

                //展开组件中的所有节点
                //treeView1.SelectedNode.ExpandAll();
                //定位根节点
                //treeView1.SelectedNode = treeView1.Nodes[0];
                treeView1.SelectedNode = null;
            }

  • 相关阅读:
    存储过程
    loadrunner性能测试——入门
    loadrunner性能测试——第一步 录制脚本(中文版)
    LoadRunner初级教程
    LoadRunner培训初级教程
    帮同学参加数学建模做的求点集间最短距离,时间复杂度300*300
    整数划分问题
    MOOC《Python网络爬虫与信息提取》学习过程笔记【requests库】第一周4-
    MOOC《Python网络爬虫与信息提取》学习过程笔记【requests库】第一周1-3
    我的博客园链接
  • 原文地址:https://www.cnblogs.com/hutie1980/p/5949479.html
Copyright © 2011-2022 走看看