TreeView Clear() function

6 posts, 0 answers
  1. Fredrick Smith
    Fredrick Smith avatar
    33 posts
    Member since:
    Feb 2007

    Posted 27 Jun 2007 Link to this post

    Ok,

    I'm having a problem that is driving me crazy.

    I have a RadTreeView that is updated each time someone changes rows in a DataGridView that is besides the RadTreeView. Now the thing is that on some ocations, there are no entries to be displayed on the RadTreeView. I use clear each time a row change occurs, but the RadTreeView still keeps the values of the old entries, even after calling the RadTreeView.Clear() function and then RadTreeView.Refres().

    Now, shouldn't this clear the RadTreeView and leave it with NO nodes?

    Thanks,

    Ricardo
  2. Todd Anglin
    Todd Anglin avatar
    2040 posts
    Member since:
    Aug 2005

    Posted 27 Jun 2007 Link to this post

    Ricardo,

    Sorry to hear you're having trouble. I agree that this process is a little confusing and it should probably be improved in the next release of the control.

    Basically, it appears that calling radTreeView1.Nodes.Clear() only removes the expand/collapse nodes and not the full text of the node, too. To remove all of the nodes for now, try doing this instead:

    this.radTreeView1.Nodes.Clear();
    this.radTreeView1.Controls.Clear();

    That should get rid of all nodes in the TreeView. Let me know if that helps.

    Thanks~
    Todd
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Fredrick Smith
    Fredrick Smith avatar
    33 posts
    Member since:
    Feb 2007

    Posted 28 Jun 2007 Link to this post

    Todd, thanks for your help.

    Unfortunately it doesn't work. I used the two commands and I still get left overs from on the RadTreeView.

    Any other ideas?

    Ricardo
  5. Jordan
    Admin
    Jordan avatar
    547 posts

    Posted 29 Jun 2007 Link to this post

    Hi Fredrick,

    You could try invalidating the treeview as follows:

    this.radTreeView1.Nodes.Clear();  
    this.radTreeView1.InvalidateLayout(); 



    Kind regards,
    Jordan
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  6. Fredrick Smith
    Fredrick Smith avatar
    33 posts
    Member since:
    Feb 2007

    Posted 29 Jun 2007 Link to this post

    Yess, finally it worked.

    Now my question is, why do I need to do this? Shouldn't the Clear() function already do this automatically?


    Thanks you all for your help!

    Ricardo
  7. Jordan
    Admin
    Jordan avatar
    547 posts

    Posted 03 Jul 2007 Link to this post

    We are happy to hear that we were able to help, Fredrick.

    Very good question, indeed. This little glitch is already fixed and will appear in SP2 due next week.

     
    Best wishes,
    Jordan
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
Back to Top
UI for WinForms is Visual Studio 2017 Ready