/// <summary> /// 绑定报表功能菜单树 /// </summary> public void BindReportTreeData() { tvReport.Nodes.Clear(); DataTable dtReportCategory = WebReportCategoryBLL.Instance.GetAll(); List <TreeNode> nodes = WebReportCategory.WebReportCategoryTree.GetTree(dtReportCategory); TreeNode root = new TreeNode(); root.Text = "报表功能菜单树"; root.Value = "0"; var listReportInfo = WebReportInfoBLL.Instance.GetAllList("DELETED = 0 and STATUS=1", "CATEGORYID"); int? categoryID = -1; TreeNode findNode = null; foreach (var item in listReportInfo) { if (categoryID != item.CATEGORYID) { findNode = TreeNodeHelper.GetNodeByID(nodes, "" + item.CATEGORYID); } if (findNode != null) { TreeNode childeNode = new TreeNode(); childeNode.Value = "Info_" + item.ID; //加Info_前缀的目的是防止ID和类别的ID相同 childeNode.Text = "" + item.NAME; findNode.ChildNodes.Add(childeNode); categoryID = item.CATEGORYID; } } foreach (TreeNode node in nodes) { root.ChildNodes.Add(node); } tvReport.Nodes.Add(root); }