Try Now
More in this section

Forums / General Discussions / Showing count in Categotries - Rad Tree View

Showing count in Categotries - Rad Tree View

2 posts, 0 answered
  1. Asif
    Asif avatar
    110 posts
    18 Nov 2010
    23 Dec 2010
    Link to this post
    I am using my code to show the categories in RadTreeView. I am not sure how to show count next to each category. Any help


    ContentManager contentManager = new Telerik.Cms.Engine.ContentManager("Videos");



    IList filteredList = contentManager.GetCategories();



    CategoriesTreeView.DataTextField =



    CategoriesTreeView.DataFieldID =



    CategoriesTreeView.DataValueField =



    CategoriesTreeView.DataFieldParentID =



    CategoriesTreeView.DataSource = filteredList;

    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 =

    "~/video.aspx?CntCatID=" + nodeCategory.ID;


    e.Node.ToolTip = nodeCategory.CategoryName;



  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    19 Oct 2016
    24 Dec 2010
    Link to this post
    Hi Asif,

    You can use the code below to return the count of the categorized content.

    IList categoriesTree = Manager.GetCategoriesTree(category);
    List<IMetaSearchInfo> filter = new List<IMetaSearchInfo>();
    filter.Add(new MetaSearchInfo(MetaValueTypes.ShortText, "Category", categoryItem.CategoryName, SearchCondition.Equal, JoinType.And));
    int contentCount = Manager.GetContent(filter.ToArray()).Count;

    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