Try Now
More in this section

Forums / Developing with Sitefinity / Categories Tree - Display All Categories

Categories Tree - Display All Categories

2 posts, 0 answered
  1. Daniel Gibson
    Daniel Gibson avatar
    4 posts
    20 Nov 2009
    14 Dec 2010
    Link to this post

    I need to get the categories tree to display all categories regardless of whether or not there is content listed in that category. Is there an easy way to do this? I didn't see it in the advanced settings.

    Thank you!
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    19 Oct 2016
    14 Dec 2010
    Link to this post
    Hello Daniel,

    You need to create a custom control and bind the categories manually, because we remove all categories which does not have items due to performance reasons.


           //CategoriesTreeView is RadTreeView control
           this.CategoriesTreeView.DataTextField = "CategoryName";
           this.CategoriesTreeView.DataFieldID = "ID";
           this.CategoriesTreeView.DataValueField = "ID";
           this.CategoriesTreeView.DataFieldParentID = "ParentCategoryID";
           this.CategoriesTreeView.DataSource = filteredList;
           this.CategoriesTreeView.NodeDataBound +=new Telerik.Web.UI.RadTreeViewEventHandler(CategoriesTreeView_NodeDataBound);
    void CategoriesTreeView_NodeDataBound(object sender, Telerik.Web.UI.RadTreeNodeEventArgs e)
           ICategory nodeCategory = (ICategory)e.Node.DataItem;
           e.Node.NavigateUrl = ""//set the navigate url
           e.Node.ToolTip = nodeCategory.CategoryName;

    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
2 posts, 0 answered