private void Populate(TreeNode node) { if (BrandId != 0) { IList <BrandCategory> brandCategories = new List <BrandCategory>(); if (node.Value == ROOT_INDEX.ToString()) { node.Text = BrandService.GetBrandById(BrandId).Name; brandCategories = BrandService.GetBrandCategoriesByBrandParent(BrandId, ROOT_INDEX); } else { brandCategories = BrandService.GetBrandCategoriesByParentId(Convert.ToInt32(node.Value)); } if (brandCategories.Count > 0) { PopulateCategories(node, brandCategories); } else { node.SelectAction = TreeNodeSelectAction.Select; } } }