I was thinking that if the Category has a parent id, then I know it is a subcategory so I shouldn't display it. So I modified the ascx page within the Page_Init call to check the ParentId value. Since the ParentId value of 0 means it is a top category, I figured this would work! But it didn't
The code I added is to the 2nd if statement below "(node.Category.ParentId == 0)".
That didn't work, so what would be my best approach?
Code: Select all
foreach (CatalogNode node in _Category.CatalogNodes)
{
if (node.Visibility == CatalogVisibility.Public)
{
bool addNode = true;
if ((node.CatalogNodeType == CatalogNodeType.Category) && (node.Category.ParentId == 0))
{
addNode = (CatalogDataSource.CountForCategory(node.CatalogNodeId, true) > 0);
}
if (addNode) _ContentNodes.Add(node);
}
}