+1-888-365-2779
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
    Registered:
    18 Nov 2010
    23 Dec 2010
    Link to this post
    Hi,
    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

    Telerik.Cms.Engine.

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

     

     

    IList filteredList = contentManager.GetCategories();

     

     

    CategoriesTreeView.DataTextField =

    "CategoryName";

     

    CategoriesTreeView.DataFieldID =

    "ID";

     

    CategoriesTreeView.DataValueField =

    "ID";

     

    CategoriesTreeView.DataFieldParentID =

    "ParentCategoryID";

     

    CategoriesTreeView.DataSource = filteredList;

    CategoriesTreeView.NodeDataBound +=

    new Telerik.Web.UI.RadTreeViewEventHandler(CategoriesTreeView_NodeDataBound);

     

    CategoriesTreeView.DataBind();

    }

     

    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
    Registered:
    09 Dec 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;


    Greetings,
    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