This is a migrated thread and some comments may be shown as answers.

Hierarchical Data Binding not working

7 Answers 164 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Richard Priddy
Top achievements
Rank 1
Richard Priddy asked on 22 Jul 2008, 12:21 PM

Hello,

I have copied some of your example about Hierarchical Data Binding but for some reason my copy is not producing a herarchical view, all of the items are bound to the same menu level.

Code:

TreeView1.DataValueField = "Id";
TreeView1.DataTextField = "Name";
TreeView1.DataFieldParentID = "ParentId";

TreeView1.DataSource = ModelManager.Provider.GetMembersBookmarks(5148);
TreeView1.DataBind();

Data:

Id, Name,                ParentId 
1    Bookmarks         0
2    folder                 1
3    test                    2

I hope that you can help me. 

Many thanks

Richard Priddy

7 Answers, 1 is accepted

Sort by
0
Simon
Telerik team
answered on 23 Jul 2008, 10:18 AM
Hi Richard Priddy,

ParentID of the root Nodes should be NULL in the database as a requirement for the Hierarchical Data Binding to work correctly.

This is also shown in this help article.

Best wishes,
Simon
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Richard Priddy
Top achievements
Rank 1
answered on 24 Jul 2008, 08:41 AM

Hello,

I have switched that over to be null in my database, when copying the code from your example, where the SQL is written in the code everything seems to work fine.

I, however, am using a collection (Inherits from GenericCollectionBase) and am still getting the problem of non-hierachical displays.

Any thoughts would be appritiated.

Richard

0
Simon
Telerik team
answered on 25 Jul 2008, 02:13 PM
Hi Richard Priddy,

RadTreeView supports hierarchical databinding only to IHierarchicalEnumerable/IHierarchicalDataSource and DataSet/DataTable/DataView (through setting the DataFieldID/DataFieldPerentID).

Just for your information, hierarchical databinding will be available with the next Service Pack of RadControl for ASP.NET AJAX.

Until then, I suggest you try out this Code Library Project.

Regards,
Simon
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Josh Anderson
Top achievements
Rank 1
answered on 25 Jul 2008, 06:22 PM
Looks like I'll need that service pack, too.  Any ETA on it?

Josh
0
Atanas Korchev
Telerik team
answered on 28 Jul 2008, 07:30 AM
Hi Josh Anderson,


Greetings,
Albert
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Josh Anderson
Top achievements
Rank 1
answered on 30 Jul 2008, 09:09 PM
Sorry Albert, I didn't catch your reply...
0
Atanas Korchev
Telerik team
answered on 31 Jul 2008, 06:11 AM
Hello Josh Anderson,

Please excuse me for the inconvenience. My reply seems to have been sent prematurely. The ETA for this feature is the first service pack of the Q2 release which is due at the end of August. Should you need the bits earlier open a support ticket and we will send you the current unofficial build.

Greetings,
Albert
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
TreeView
Asked by
Richard Priddy
Top achievements
Rank 1
Answers by
Simon
Telerik team
Richard Priddy
Top achievements
Rank 1
Josh Anderson
Top achievements
Rank 1
Atanas Korchev
Telerik team
Share this question
or