RadTreeView Clear Nodes

8 posts, 0 answers
  1. Josh
    Josh avatar
    29 posts
    Member since:
    Feb 2009

    Posted 04 Nov 2009 Link to this post

    We just installed Winforms Q3 2009 and are noticing a problem.

    We added a Treeview to a new application and ran the following two lines.

    RadTreeView1.Nodes.Add("test")
    RadTreeView1.Nodes.Clear()

    The problem we are seeing is that after running this, the 'test' node still shows on the screen.
    It seems that we are able to delete additional nodes, but that we are not able to delete the last node.
  2. Victor
    Admin
    Victor avatar
    1351 posts

    Posted 05 Nov 2009 Link to this post

    Hi Josh,

    Thank you for writing. I managed to reproduce the issue. It will be fixed for the upcoming Q3 2009 service pack. Write again if you experience other issues or if you have questions regarding our controls.

    Regards,
    Victor
    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. UI for WinForms is Visual Studio 2017 Ready
  4. MP
    MP avatar
    22 posts
    Member since:
    May 2009

    Posted 09 Nov 2009 Link to this post

    I have also come across a similar issue when rebinding the tree with an empty dataset. Some of the nodes are retained even though the dataset is empty.

    Scenario:
    • I bind a dataset to the treeview control and see the tree nodes (using the ParentIdMember property).
    • I requery the database based on user action and get an empty dataset (0 rows) and rebind to the treeview control.
    • Instead of showing an empty tree, some of the nodes are retained in the tree.
    • I tried using Nodes.Clear(), setting DataSource, DataMember, DisplayMember & ParentIdMember to null but the issue still remains.

    This will be a showstopper for us to upgrade to Q3-2009 release since we haven't found any workaround for this issue. Pls share if you have identified any workarounds so far.

    Thanks,
    MP

  5. Victor
    Admin
    Victor avatar
    1351 posts

    Posted 16 Nov 2009 Link to this post

    Hi MP,

    Thank you for writing.

    We are aware of RadTreeView having issues with binding to empty data sources, but I am more inclined to think that this issue is related to the previous one you described. We will correct this issue in the Q3 2009 Service pack which is due in about two weeks.
    Please write again if you have other issues that you need assistance with or if you have questions about our controls.

    Best wishes,
    Victor
    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.
  6. Joe
    Joe avatar
    8 posts
    Member since:
    Apr 2009

    Posted 18 Nov 2009 Link to this post

    This issue only seems to affect the tree when no new nodes are added after calling Nodes.Clear()

    Adding a new node to the tree after clearing all nodes and setting the visibility of the new node to false seems to be a workaround for this issue.

    Hope this helps, it works for me until the SP is released...
  7. Victor
    Admin
    Victor avatar
    1351 posts

    Posted 18 Nov 2009 Link to this post

    Hi Joe,

    I confirm that the issue is now fixed and will be available in the Q3 2009 SP1 release. Write again if you need assistance with our controls.

    Greetings,
    Victor
    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.
  8. Jorge Delgado-Lopez
    Jorge Delgado-Lopez avatar
    82 posts
    Member since:
    Aug 2007

    Posted 18 Nov 2009 Link to this post

    hi.

    is there a workaround? i am releasing in 4 days.

    I do not bind but add on demand so to say. Remove() does not work either.

    thanks
    -j
  9. Victor
    Admin
    Victor avatar
    1351 posts

    Posted 23 Nov 2009 Link to this post

    Hi Jorge Delgado-Lopez,

    I am afraid that the only possible workaround would be to use reflection since this method is internal and cannot be accessed by subclassing RadTreeView. Here is what you need to do in order to invoke it.
    In your form constructor you need to obtain a MethodInfo object like so:
    MethodInfo updateUIMethod = null;
    public Form1()
    {
        InitializeComponent();
        updateUIMethod = this.radTreeView1.GetType().GetMethod("UpdateUI", BindingFlags.Instance | BindingFlags.NonPublic);
    }

    Then, in all the situations in which your nodes do not get cleared, you need to invoke the method info like so:
    updateUIMethod.Invoke(this.radTreeView1, new object[] { false, true });

    Please note that reflection code is brittle and you need to remember to remove it when we release the service pack.

    Write again if you need further assistance.

    Kind regards,
    Victor
    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
UI for WinForms is Visual Studio 2017 Ready