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