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 asp.net 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

 

Niki

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.

Cheers

Steve 

PS This looks like it does the trick - http://www.bolaky.net/page/Creating-a-nested-html-list-for-the-Category-List-in-BlogEngineNET-Part-One.aspx

Dec 2, 2013 at 5:54 AM
Hello.
Thank you very much for this effort on this link
http://www.bolaky.net/page/Creating-a-nested-html-list-for-the-Category-List-in-BlogEngineNET-Part-One.aspx

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
2.6
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
Hello.
in the admin section
http://www.bolaky.net/page/Binding-the-category-list-to-a-Treeview-control-Part-Two.aspx

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?)

Screenshot:
http://goo.gl/ksEMEg
the code file
http://goo.gl/XuQFW8

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)
            {
                childrenOfRoot.Add(cat);
            }
            return childrenOfRoot;
        }
    }
any help ??