This project is read-only.

CategoryList in a TreeView

Aug 12, 2009 at 4:48 AM
Edited Aug 12, 2009 at 5:19 PM

Hello everyone,

                                       I just wanted to know whether there is a category list widget which shows all the categories in a tree view control. It should be like a child category should be displayed as a sub node of a parent category .

If there is already one existing it would be very helpful if you give me the link.

I am in great need of such a control(widget) .

Thank you in advance for your help



Jan 23, 2010 at 6:04 PM
Edited Jan 23, 2010 at 6:24 PM

Hi Niki, did you manage to find a solution to this? I'm going add this functionality if it hasn't been done already.



PS This looks like it does the trick -

Dec 2, 2013 at 5:54 AM
Thank you very much for this effort on this link

Is it possible to show the posts in the tree?
Means each categroy includes underneath its posts.
Dec 4, 2013 at 7:30 AM
Is this code compatible with version
Dec 4, 2013 at 8:26 AM
Edited Dec 4, 2013 at 8:26 AM
I am now working on version 2.8
I copied the file EnhancedCategoryList.cs
on the path /App_Code/Controls folder

But in line number 116 is used ChildCategories
Category of the class
Therefore created and which is

public Categories ChildCategories
get { return _ChildCategories; }
set { _ChildCategories = value; }

But the class Categories do not exist.
Therefore established the class Categories.cs beside Category.cs
And copied the

public class Categories: List
     List cat = null;
     public Categories (): base ()
         cat = new List ();

But he did not see the class List
Am I working correctly or is there an error??
Dec 7, 2013 at 9:05 AM
Thank you.
it is now working fine in the front end
Dec 7, 2013 at 9:18 AM
in the admin section

After that I did inherit the interface 'IHierarchyData' in the Category class.
and I wrote GetParent() method

public IHierarchyData GetParent()
        if (parent != null)
            return parent;
        return null;
Which gives the value of 'IHierarchyData' type and is defined:
private Guid? parent;

Gives the error:
Cannot implicitly convert type 'System.Guid?' to 'System.Web.UI.IHierarchyData' \BlogEngine.NET 2.6 (source)\Source\BlogEngine\BlogEngine.Core\Category.cs
Is it helping?
Dec 8, 2013 at 9:23 AM
In a Select method within the class CategoryDatasourceView:
There is a problem in converting
(BlogEngine.Core.Categories) To (System.Web.UI.IHierarchicalEnumerable)
The text of the error:
Cannot implicitly convert type 'BlogEngine.Core.Categories' to 'System.Web.UI.IHierarchicalEnumerable'. An explicit conversion exists (are you missing a cast?)

the code file

the class code
 public class CategoryDatasourceView : HierarchicalDataSourceView
        string viewPath;
        Category rootCategory;

        public CategoryDatasourceView(string ViewPath)
            viewPath = ViewPath;
        public CategoryDatasourceView(Category root)
            rootCategory = root;
        public override IHierarchicalEnumerable Select()
            Categories childrenOfRoot = new Categories();
            foreach (Category cat in rootCategory.ChildCategories)
            return childrenOfRoot;
any help ??