ParentID Problem

6 posts, 1 answers
  1. Juan Carlos Carrasco
    Juan Carlos Carrasco avatar
    9 posts
    Member since:
    Oct 2009

    Posted 24 Nov 2009 Link to this post

    Hi, this my sql code:

    SELECT     Customer.CustomerID, StateAfi.Icono, Customer.FirstName, Customer.Parentafi  
    FROM       Customer INNER JOIN 
               StateAfi ON Customer.Stateafi = StateAfi.Stateafi   
               WHERE Parentafi>=@Parentafi or CustomerID=@Parentafi 

    and my data:

    CustomerID     parentafi
    1                      NULL
    2                      1
    3                      2
    4                      2
    5                      2
    6                      5

    my problem is when i choose like this:

    @Parentafi  =  2

    my first row is CustomerID = 2 and his Parentafi = 1, not "Null" and always i see a message error, how i can fix this problem,  please thx!
  2. Yana
    Admin
    Yana avatar
    5013 posts

    Posted 25 Nov 2009 Link to this post

    Hello Juan,

    The problem is that there's no root node when Parentafi >= 2,  the treeview should have at least one node with Parentafi = null - root node.

    Kind regards,
    Yana
    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.
  3. Juan Carlos Carrasco
    Juan Carlos Carrasco avatar
    9 posts
    Member since:
    Oct 2009

    Posted 25 Nov 2009 Link to this post

    i want to try show from CustomerID = 5 like this:

    customerID = 5  (but parentafi = 2)
                 |___ CustomerID = 6


     its possible choose the customerID to build the treeview when this one have a parentafi <> null??? or how i can show the treeview like my example. Thx again!

    Juanca

  4. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 26 Nov 2009 Link to this post

    Hi Juan,

    This is only possible if you create a separate dataset where you change the parent ID value from "2" to null. The must-have requirement when Binding to Hierarchical Data is that the root nodes' ParentID is null.

    Regards,
    Peter
    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.
  5. Juan Carlos Carrasco
    Juan Carlos Carrasco avatar
    9 posts
    Member since:
    Oct 2009

    Posted 26 Nov 2009 Link to this post

    Any example for this query? How to create this dataset please!!! Thx
  6. Answer
    Veselin Vasilev
    Admin
    Veselin Vasilev avatar
    2992 posts

    Posted 27 Nov 2009 Link to this post

    Hi Juan Carlos Carrasco,

    I believe the problem is the same as this one.

    Greetings,
    Veselin Vasilev
    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