首页 > 代码库 > 填充树节点

填充树节点

 1         Endv.DataHelper myHelper = new Endv.DataHelper(); 2             DataSet ds = myHelper.GetDataSet("select * from Right"); 3  4             DataTable dt = ds.Tables[0]; 5  6             //1 7             DataRow[] drParent = dt.Select(“PID = ‘0‘"); 8  9             foreach (DataRow dr in drParent)10             {11                 TreeNode Node = tree1.Nodes.Add(dr["Name"].ToString());12                 Node.Tag = dr["ID"].ToString();13                 //214                 DataRow[] drChild = dt.Select("F_PID = ‘" + dr["ID"].ToString() + "");15                 foreach (DataRow dr1 in drChild)16                 {17                     TreeNode cNode = Node.Nodes.Add(dr1["Name"].ToString());18                     cNode.Tag = dr1["ID"].ToString();19                 }20             }21 22             ds.Dispose();

 

填充树节点