protected void CategoryTree_NodeChanged(object sender, EventArgs e) { try { TreeNode treeNode = this.uxTree.SelectedNode.To <TreeNode>(); ViSoTreeNode node = new ViSoTreeNode(treeNode); this.SelectedCategoryId = node.CarierId; this.presenter.LoadCategoryReports(); } catch (Exception err) { throw; } }
private void LoadCategoryTree(List <ReportCategoryModel> categories, ViSoTreeNode parentNode = null) { foreach (ReportCategoryModel parent in categories.Where(p => (parentNode == null ? !p.ParentCategoryId.HasValue : p.ParentCategoryId == parentNode.CarierId))) { ViSoTreeNode node = new ViSoTreeNode(parent.CategoryId, parent.CategoryName); node.CarierId = parent.CategoryId; this.LoadCategoryTree(categories, node); node.CollapseAll(); if (parentNode == null) { this.uxTree.Nodes.Add(node); } else { parentNode.ChildNodes.Add(node); } } }