I have this table structure:
- CategoryID
- CategoryName
- ParentID
I want to load data from this table into a treeview control, to be able to edit/delete these records. How to do that?
I have this table structure:
- CategoryID
- CategoryName
- ParentID
I want to load data from this table into a treeview control, to be able to edit/delete these records. How to do that?
For more details see: How do you databind to a TreeView control? (the question is WinForms, but still applies to ASP.NET)
The long and short is that you can't databind to a TreeView. TreeViews are hierarchical data structures and as such do not have a native binding mechanism. You'll have to roll your own binding to do this.
I was going write the solution but there is a very good article here showing you how to bind the ASP.NET TreeView control using various datasources:
The latter point I would strongly recommend once your data has been returned from your database.
But if it is a sitemap your creating I would use XML to store it depending on its size.
Hope this helps