cyrus_ Posted May 10, 2006 Share Posted May 10, 2006 Hi,I am trying to load my items from Database to a Treeview but i have faildMy table contains id, parentId, nodeName like this:(1 , 1 RootNode)(2 , 2 , ParentNode)(3, 2 , Child_for_2)(4, 4 , AnotherParent)(5 , 2 , anotherChild_for_2)(6 , 4 , Child_for_4)My problem is ,, I can not read it to my Treeveiw ( need some code).thanks Link to comment Share on other sites More sharing options...
aspnetguy Posted May 10, 2006 Share Posted May 10, 2006 Are you using ASP.Net 2.0's built-in TreeView??? Are you using a 3rd party Treeview???What do you mean you failed??? What code did you try.We need a bit more info here. Link to comment Share on other sites More sharing options...
cyrus_ Posted May 10, 2006 Author Share Posted May 10, 2006 Are you using ASP.Net 2.0's built-in TreeView??? Are you using a 3rd party Treeview???What do you mean you failed??? What code did you try.We need a bit more info here.<{POST_SNAPBACK}> thanks,I am using asp.net 2.0here is a bit of my code what i have been trying for 6 hours. try { treeView.BeginUpdate(); DataSet DS = new DataSet(); DS = MyWebService.LoadTreeViewFromDB(); if (DS != null) { TreeNode Root = new TreeNode("Taxonomy"); Root.Tag = 1; treeView.Nodes.Add(Root); TreeNode ParentNode = null; foreach (DataRow DR in DS.Tables["folksonomy"].Rows) { TreeNode NewNode = new TreeNode(); if (DR["id"].ToString() == DR["parentid"].ToString()) { NewNode.Text = DR["nodename"].ToString(); NewNode.Tag = DR["id"].ToString(); Root.Nodes.Add(NewNode); } else { foreach (DataRow ChildDataRow in DS.Tables["folksonomy"].Rows) { if (ChildDataRow["id"].ToString() == DR["parentid"].ToString()) { I dont know i should write here } } } } } Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now