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

Treeview for Winform throws System.StackOverflowException

4 Answers 75 Views
Treeview
This is a migrated thread and some comments may be shown as answers.
Mike
Top achievements
Rank 2
Mike asked on 27 Mar 2008, 09:04 PM
I have a treeview that is blowing up on loading in data. Here is what is happening.

dsVariables = GetDocVariables()

RadTreeView2.Nodes.Clear()

RadTreeView2.ParentIDMember =

"ParentID"

RadTreeView2.ValueMember =

"HierarchicalID"

RadTreeView2.DisplayMember =

"VariableText"

RadTreeView2.DataSource = dsVariables.Tables(0)


Here is the data:

ParentID HierarchicalID  VariableText
0  0   TEST
0  600   ONE
600  601   TWO

Why is the treeview throwing an error??????

4 Answers, 1 is accepted

Sort by
0
Accepted
Jordan
Telerik team
answered on 28 Mar 2008, 08:21 AM
Hello mike scardina,

There was an issue in the RadTreeView data binding functionality, that caused recursion in the tree view structure in your particular scenario. This issue is now addressed and will not appear in 2008 Q1 release.

For the time being, you can easily workaround this issue by setting the ParentID value for the root node to -1 instead of 0.

Regards,
Jordan
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Stefan
Telerik team
answered on 22 Mar 2011, 03:06 PM
Hello Mike,

Please note that in Q1 2011 we have introduced a major upgrade of RadTreeView control, which is now virtualized and fully customizable. Feel free to download the latest release and try it out. For more information on our latest release refer to this blog post.
 
Best wishes,
Stefan
the Telerik team
0
Javier
Top achievements
Rank 1
answered on 16 Mar 2018, 05:54 PM

Hello! I am trying to upload a beam from a recursive table with the following fields:

ID; NAME; ID_FK; TYPE;

1;   CARLOS NULL  0

2;    PETER   NULL  0

3;    JHON     1          1

4;    MARY     1          1

 

Now I would like it to be loaded according to the relationship, how could I do it?

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 19 Mar 2018, 12:41 PM
Hello, Javier,  

You can find below a sample code snippet demonstrating how to bind RadTreeView to self-reference data: 
DataTable dt = new DataTable();
dt.Columns.Add("ID", typeof(int));
dt.Columns.Add("NAME", typeof(string));
dt.Columns.Add("ID_FK", typeof(int));
dt.Columns.Add("TYPE", typeof(int));
 
dt.Rows.Add(1, "CARLOS", 0, 0);
dt.Rows.Add(2, "PETER", 0, 0);
dt.Rows.Add(3, "JHON", 1, 1);
dt.Rows.Add(4, "MARY", 1, 1);
 
this.radTreeView1.DisplayMember = "NAME";
this.radTreeView1.ParentMember = "ID_FK";
this.radTreeView1.ChildMember = "ID";
this.radTreeView1.DataSource = dt;



Additional information is available in the following help article: https://docs.telerik.com/devtools/winforms/treeview/data-binding/binding-to-self-referencing-data

I hope this information helps. If you have any additional questions, please let me know. 

Regards,
Dess
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Treeview
Asked by
Mike
Top achievements
Rank 2
Answers by
Jordan
Telerik team
Stefan
Telerik team
Javier
Top achievements
Rank 1
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or