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

ParentID Problem

5 Answers 88 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Juan Carlos Carrasco
Top achievements
Rank 1
Juan Carlos Carrasco asked on 24 Nov 2009, 08:15 PM
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!

5 Answers, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 25 Nov 2009, 09:23 AM
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.
0
Juan Carlos Carrasco
Top achievements
Rank 1
answered on 25 Nov 2009, 07:00 PM
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

0
Peter
Telerik team
answered on 26 Nov 2009, 03:44 PM
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.
0
Juan Carlos Carrasco
Top achievements
Rank 1
answered on 27 Nov 2009, 02:44 AM
Any example for this query? How to create this dataset please!!! Thx
0
Accepted
Veselin Vasilev
Telerik team
answered on 27 Nov 2009, 02:35 PM
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.
Tags
TreeView
Asked by
Juan Carlos Carrasco
Top achievements
Rank 1
Answers by
Yana
Telerik team
Juan Carlos Carrasco
Top achievements
Rank 1
Peter
Telerik team
Veselin Vasilev
Telerik team
Share this question
or