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

Parent and Child Ids are same throwing "these columns don't currently have unique values" error

1 Answer 119 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Bill
Top achievements
Rank 1
Bill asked on 16 Oct 2009, 08:20 PM
Hey,

I'm using a radtreeview control to map relations between 2 recordsets and I do it all in a single stored proc as specified in the example provided in the documentation.

I get the radtreeview working flawlessly, except for in one situation. The situation involves a parent and child sharing the same id which confuses the control somehow. The failing recordset would look like.

ParentID    ID    Title
null             1       Car
null             2       Motorcycle
1                1        Honda Civic
1                5        Ford Focus
2                3        Yamaha
2                6        Suzuki


radTreeView1.DataTextField =

"Title";

radTreeView1.DataFieldID =

 

 

"ID";

radTreeView1.DataFieldParentID =

 

 

 

"ParentID";

radTreeView1.DataSource = myResultSet;

radTreeView1.DataBind();

The italized record in the example where parentid and id are sharing the same value of 1 would throw an error "these columns don't currently have unique values." If I remove that record, then it will work.

This example should read if the parentid is null then make it the root element, then map all records with a parentid value to it's corresponding id value, but in this case it does not like the fact that I have a child and parentid matching even though the id field of the second level items should not matter one bit because it shouldn't be factored in the equation.

Thanks in advance.

 

 

 

 

1 Answer, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 19 Oct 2009, 06:40 AM
Hi Bill,

The column specified by the DataFieldID property must contain unique values. In your case 'Car' and 'Honda Civic' both have ID = 1 which is causing this problem.

Regards,
Albert,
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
TreeView
Asked by
Bill
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Share this question
or