Skip to main content


 

Symptoms


GetChildCategories() method does not work SourceCode.Categories.Client()
 

Diagnoses


On the SourceCode.Categories.Client Category class, GetChildCategories() method. Does not work. Does not return any results. I have a category with a nested category. (see screen shots).

In my scenario i would expect the method would at least return TestNest1 for the Default category. And TestNest2 for the TestNest1 category.
 

Resolution

The issue of the "Category Explorer" object/type returning 0 for the ChildCategoryIds has been logged as a bug. A possible workaround is to use the "Category Manager" object/type instead:

CategoryManager cm = catServer.GetCategoryManager(1, true)
foreach (Category c in cm.Categories)
{
CategoryIdCollection cic = c.ChildCategoryIds
Console.Write("Name: " c.Name " ")
Console.WriteLine("CategoryIdCollection.Count: " cic.Count " ")

//Or retrieving the length of GetChildCategories()
//Console.WriteLine("GetChildCategories().Length: " c.GetChildCategories().Length)
}




 
Be the first to reply!

Reply