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

2 posts, 0 answers
  1. Bill
    Bill avatar
    5 posts
    Member since:
    Mar 2009

    Posted 16 Oct 2009 Link to this post

    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.

     

     

     

     

  2. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 19 Oct 2009 Link to this post

    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.
Back to Top