Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET > Treeview > View the amount of items in a RadTreeView
RadControls for ASP.NET are no longer supported (see this page for reference). In case you have inquiries about the Telerik ASP.NET AJAX controls, post them in the pertinent ASP.NET AJAX forums.

Not answered View the amount of items in a RadTreeView

Feed from this thread
  • Leandro avatar

    Posted on Apr 18, 2011 (permalink)

    Hi All,

    I have a RadTreeeView which is populated with ADO.NET as the code below.
    This RadTreeView represent categories and subcategorias with the type Parent and Child.

    There are articles which are related to the category.
    I wonder if it's possible and how do I report the amount of items in each categoryrepresenting this way:


    + Car(08)
    The eight count which means there are 8 articles in this category

    Model Base MS SQL:
    Table: ArticleCategory
    CategoryId      int, (PK)
    ParentId          int, (FK)
    Text                 varchar(50)

    Table: Article
    ArticleId          int, (PK)
    CategoryId     int, (FK)
    Text                varchar(250),
    Description     nvarchar(MAX)


        protected void Page_Load(object sender, EventArgs e)
        {
            SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["NameConnectionString"].ConnectionString);
            string SQL = "Select * From ArticleCategory";
            SqlCommand cmd = new SqlCommand(SQL, con);
            con.Open();
            SqlDataReader dr = cmd.ExecuteReader();
            RadTreeView1.DataTextField = "Text";
            RadTreeView1.DataFieldParentID = "ParentId";
            RadTreeView1.DataValueField = "CategoryId";
            RadTreeView1.DataFieldID = "CategoryId";
            RadTreeView1.DataSource = dr;
            RadTreeView1.DataBind();
            con.Close();
            dr.Close();  
        }

    An example is the address below that tells you how much videos in each category.
    http://tv.telerik.com/search?sortby=most% 20recent


    Tky

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET > Treeview > View the amount of items in a RadTreeView