It is not possible to bind a TreeView to a SqlDataSource, but you can use an XmlDataSource. The TreeView is designed to render data in a hierarchical format.
You can find a good sample in the ASP.NET QuickStarts:
The TreeView's dataSource can be sitemapdataource and xmldatasource, but you can't bind the treeview to a SqlDataSource control directly.However, you can try
to utilize the new TreeView control in ASP.NET 2.0 to display hierarchical data from a database. About this, you can refer this link:
http://aspalliance.com/732
And you also can refer this link:
http://aspalliance.com/822, which talks how to populate a menu from the database, and convert the data queried from the database into
xml, and then make the menu bind to the xml. By using this solutionm, you only need to replace the Menu/MenuItem with the Treeview/TreeNode.
Amanda Wang
Microsoft Online Community Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Based on many articals and tries i made this control wich takes the ID and Parent ID and Text Fields from the Table you spacify and a connection string to the server and view your data in a tree view.
i hope it helps you.
just add it to your Bin Folder and choose it as an item into your tool box
pritpal_simr...
0 Points
1 Post
How to bind a Sql Data Source to a Tree View
Jul 15, 2008 02:37 PM|LINK
Hello everybody there.
Respected Sir/Mam,
i am new in ASP.NET development.. only 3 weeks ago i have started working.. could u please help me in the way:
How to bind a Sql Data Source to a Tree View.. Please send the code in VB.Net ...
i shall be thankful to u..
dswersky
Participant
1790 Points
295 Posts
Re: How to bind a Sql Data Source to a Tree View
Jul 15, 2008 02:45 PM|LINK
It is not possible to bind a TreeView to a SqlDataSource, but you can use an XmlDataSource. The TreeView is designed to render data in a hierarchical format.
You can find a good sample in the ASP.NET QuickStarts:
http://quickstarts.asp.net/QuickStartv20/aspnet/doc/ctrlref/navigation/treeview.aspx
You can take XML-formatted data, feed that into an XmlDataSource, and bind the TreeView to the XmlDataSource.
www.daveswersky.com
Follow me on Twitter
Amanda Wang ...
All-Star
30008 Points
3104 Posts
Re: How to bind a Sql Data Source to a Tree View
Jul 17, 2008 05:56 AM|LINK
Hi,
The TreeView's dataSource can be sitemapdataource and xmldatasource, but you can't bind the treeview to a SqlDataSource control directly.However, you can try to utilize the new TreeView control in ASP.NET 2.0 to display hierarchical data from a database. About this, you can refer this link: http://aspalliance.com/732And you also can refer this link: http://aspalliance.com/822, which talks how to populate a menu from the database, and convert the data queried from the database into xml, and then make the menu bind to the xml. By using this solutionm, you only need to replace the Menu/MenuItem with the Treeview/TreeNode.
Microsoft Online Community Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
alparody
Member
2 Points
1 Post
Re: How to bind a Sql Data Source to a Tree View
Mar 02, 2010 03:06 PM|LINK
Based on many articals and tries i made this control wich takes the ID and Parent ID and Text Fields from the Table you spacify and a connection string to the server and view your data in a tree view.
i hope it helps you.
just add it to your Bin Folder and choose it as an item into your tool box
this a small description for the control http://csharpplayers.blogspot.com/
this the link to download it BindableTreeView.dll
Regards.
.net 2.0 navigation controls tree view...... dynamic treeview ASP 2.0 Treeview OnTreeNodePopulate Load Page_load .NET 3.5 .net framework 3.5 ASP Treeview progamming .net asp .aspx vb c# <asp.net>
Senior developer