I am working on radtreeview control. I am new to telerik controls
I am having a problem, see if you guys can help me on it.
I am trying to set default static root for the categories, I have database table name called categories, has iID and iParent columns that make relation of parent and child.
I want to achieve treeview like this.
but i am gettign all child1 to child 6 at root line including root.
here is the code
SqlConnection conn = new SqlConnection(Global.SQLConnectionString);
//sqlString = "SELECT * FROM [MediaLibraryCategories]";
sqlString = "Select iID,Title,iParent From Categories Union All Select '0','root'
, -1 Order By Sort";
SqlCommand Cmd = new SqlCommand(sqlString, conn);
SqlDataReader Dr = Cmd.ExecuteReader();
RadTreeView1.DataFieldID = "iID";
RadTreeView1.DataFieldParentID = "iParent";
RadTreeView1.DataTextField = "Title";
RadTreeView1.DataValueField = "iID";
RadTreeView1.DataSource = Dr;
with Union All, 0 is the iID, root is the title, and -1 is the iParent
other data are like this..
iID, Title, iParent
1 child1 0
2 child2 0
3 child3 0
4 child4 0
5 child5 0
6 child6 0
7 child3a 3
8 child3b 3
0 Root -1