Treeview for Winform throws System.StackOverflowException

5 posts, 1 answers
  1. Mike
    Mike avatar
    76 posts
    Member since:
    Nov 2004

    Posted 27 Mar 2008 Link to this post

    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??????

  2. Answer
    Jordan
    Admin
    Jordan avatar
    547 posts

    Posted 28 Mar 2008 Link to this post

    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
  3. Stefan
    Admin
    Stefan avatar
    2908 posts

    Posted 22 Mar 2011 Link to this post

    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
  4. Javier
    Javier avatar
    13 posts
    Member since:
    Oct 2014

    Posted 16 Mar 2018 Link to this post

    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?

  5. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3198 posts

    Posted 19 Mar 2018 Link to this post

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