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

TreeView Clear() function

5 Answers 1000 Views
Treeview
This is a migrated thread and some comments may be shown as answers.
Fredrick Smith
Top achievements
Rank 1
Fredrick Smith asked on 27 Jun 2007, 08:34 PM
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

5 Answers, 1 is accepted

Sort by
0
Todd Anglin
Top achievements
Rank 2
answered on 27 Jun 2007, 11:07 PM
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
0
Fredrick Smith
Top achievements
Rank 1
answered on 28 Jun 2007, 12:42 PM
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
0
Jordan
Telerik team
answered on 29 Jun 2007, 07:18 AM
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
0
Fredrick Smith
Top achievements
Rank 1
answered on 29 Jun 2007, 12:37 PM
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
0
Jordan
Telerik team
answered on 03 Jul 2007, 10:30 AM
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
Tags
Treeview
Asked by
Fredrick Smith
Top achievements
Rank 1
Answers by
Todd Anglin
Top achievements
Rank 2
Fredrick Smith
Top achievements
Rank 1
Jordan
Telerik team
Share this question
or