/// <summary> /// Populates the nodes. /// </summary> /// <param name="list">The list.</param> /// <param name="nodes">The nodes.</param> private void PopulateNodes(List<Category> list, List<ExtTreeNode> nodes) { foreach (Category c in list) { ExtTreeNode no = new ExtTreeNode(); no.draggable = true; no.id = c.Id.ToString(); no.text = c.Name; no.leaf = false; no.expanded = true; no.cls = "category-node"; nodes.Add(no); if (c.ChildCount > 0) { PopulateSubLevel(c.Id, no); } } }
/// <summary> /// Populates the sub level. /// </summary> /// <param name="parentid">The parentid.</param> /// <param name="parentNode">The parent node.</param> private void PopulateSubLevel(int parentid, ExtTreeNode parentNode) { PopulateNodes(Category.GetChildCategoriesByCategoryId(parentid), parentNode.children); }