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

Heirarchical Binding

3 Answers 58 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Richard Weeks
Top achievements
Rank 2
Richard Weeks asked on 27 Jul 2011, 04:09 AM
Hi,

I have two columns available for creating a heirarchical treeview:

PositionNumber ReportsTo
10030          10004
10122          10030
10838          10030
10923          10030
11015          10030
11015          10030
11229          10030
11422          10030
11453          10030

When binding, I get the error "These columns don't currently have unique values".

I understand the error. There are two '11015' PositionNumber values. These are two distinct records thast have the same position number... How can I make my treeview use the values as set out above?

Actually, I don't care what the control is just so long as I can view my data heirarchically presented. If another control is more suited, do let me know!

Thanks,
Richard

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 27 Jul 2011, 09:54 AM
Hello Richard,

Please take a look at the help article which explains the same.
Binding to Hierarchical Data.

Thanks,
Shinu.
0
Richard Weeks
Top achievements
Rank 2
answered on 27 Jul 2011, 11:34 PM

In PositionNumber, there are 2 identical values. This makes sense in my scenario as these are two completely different people who just happen to have the same position and report to the same person, to refresh:

Name   PositionNumber ReportsTo 
Bob    11015          10030 
Alice  11015          10030 

How can I cater for that?

Richard

0
Accepted
Dimitar Terziev
Telerik team
answered on 29 Jul 2011, 02:14 PM
Hello Richard,

In order to be able to bind your treeview to your hierarchical data source, you should have a primary key for this table. This is needed because you should have a unique identifier for every record which could be assigned  as DataFieldID, your "ReportsTo" will be DataFieldParentID and you could use the "PositionNumber" to be bound as a DataValueField.

Unless you have unique identifier you won't be able to achieve the desired functionality.

Regards,
Dimitar Terziev
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Tags
TreeView
Asked by
Richard Weeks
Top achievements
Rank 2
Answers by
Shinu
Top achievements
Rank 2
Richard Weeks
Top achievements
Rank 2
Dimitar Terziev
Telerik team
Share this question
or