RadTreeNode.Treeview Does not Return the Treeview

6 posts, 1 answers
  1. Holger
    Holger avatar
    38 posts
    Member since:
    Jan 2015

    Posted 20 May 2018 Link to this post

    If I handle a RadTreeNode in this way:

    public partial class RadForm2 : Telerik.WinControls.UI.RadForm
        {
            private RadTreeNode m_myNode1;
            private RadTreeNode m_myNode2;
            public RadForm2()
            {
                InitializeComponent();
     
                m_myNode1 = new RadTreeNode();
                m_myNode2 = new RadTreeNode();
     
                m_myNode1.Nodes.Add(m_myNode2);
     
                radTreeView1.Nodes.Add(m_myNode1);
            }
     
            protected override void OnLoad(EventArgs e)
            {
                base.OnLoad(e);
     
                var treeview1 = m_myNode1.TreeView;
                if (treeview1 == null)
                    throw new InvalidOperationException();
     
                //var x = m_myNode2.TreeViewElement; this solves the problem, by calling FindTreeView internally
                var treeview2 = m_myNode2.TreeView;
                if (treeview2 == null)
                    throw new InvalidOperationException();
            }
        }

     

    The second Exception is thrown.

    The workaround is in the comment, if you call m_myNode2.TreeViewElement or m_myNode2.Nodes before, everything works fine,

    anything that causes internally a call to "TreeViewElement" or "FindTreeView" (i digged a bit in the source code).

    So this happens only on Nodes, without Childnodes and not for Rootnodes.

    It's more a Bug-Report than a Question, but don't know where to Post ist.

    If  the TreeView Property is the first Property called, on a RadTreeNode, it always has the value null.

     

  2. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3626 posts

    Posted 22 May 2018 Link to this post

    Hello, Holger,    

    Indeed, the TreeView property of the inner RadTreeNodes is initially loaded only for the top level nodes. The inner nodes use the TreeViewElement to load lazy the Treeview property. This is how the RadTreeView is internally implemented. Feel free to use the TreeViewElement property. It give you access to the common properties of the tree view functionality.

    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.
  3. Holger
    Holger avatar
    38 posts
    Member since:
    Jan 2015

    Posted 22 May 2018 in reply to Dess | Tech Support Engineer, Sr. Link to this post

    Your answer does not seem to confirm, that this is a bug.

     

    RadTreeNode.Treeview does not return the associated TreeView, even if attached to a treeview.

    "Lazy Loading" meens, it is called, when you access it. But it's not called.

     

    If you offer a Property "TreeView" with the Documentation "returns the Treeview, the node is attached to",

    it should work always and not just under some condition. It feels like playing Roulette with the return value of this property.

    Sometimes it returns the Treeview, sometimes it doesn't.

     

    Using TreeViewElement ist just a workaround, because this TreeView property is not working as documented.

     

     

  4. Answer
    Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3626 posts

    Posted 22 May 2018 Link to this post

    Hello, Holger,    

    If this seems confusing for you, we will log an item in our feedback portal in order to investigate the precise case and see how it can be improved. You can track its progress, subscribe for status changes and add your comments on the following link - feedback item.

    I have also updated your Telerik points

    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.
  5. Holger
    Holger avatar
    38 posts
    Member since:
    Jan 2015

    Posted 22 May 2018 in reply to Dess | Tech Support Engineer, Sr. Link to this post

    OK, thank you. Seems to be the right place for the subject.

    The source-code seems to be modified recently, there are a few out-commented lines in this area.

    And adding this little call FindTreeView() in the getter of the Treeview property should be easy.

     

  6. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3626 posts

    Posted 23 May 2018 Link to this post

    Hello, Holger,    

    We will investigate the recent changes when addressing this issue and a proper fix will be introduced accordingly. Feel free to follow the feedback item in order to get notified as soon as some changes occur.

    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