public void CallJsTree(AppUtils.category node, List <AppUtils.category> myCategories, Node parent) { var parentToBe = AddNode(node, parent); var children = AppUtils.getChildren(node, myCategories); for (var i = 0; i < children.Count; i++) { CallJsTree(children[i], myCategories, parentToBe); //call children of current node } }
public static void GetChildrenByParentId(AppUtils.category node, List <AppUtils.category> myCategories) { HttpContext.Current.Session["children"] += node.categoryId.ToString() + ","; var getParentChildren = AppUtils.getChildren(node, myCategories); foreach (var child in getParentChildren) { GetChildrenByParentId(child, myCategories); } }
public Node AddNode(AppUtils.category child, Node parent) { var newChild = new Node(); newChild.text = child.categoryName; newChild.id = child.categoryId; newChild.icon = "fas fa-folder-open text-dark pt-0"; if (parent.children == null) { parent.children = new List <Node>(); } parent.children.Add(newChild); return(newChild); }