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

RadTreeView Clear Nodes

7 Answers 594 Views
Treeview
This is a migrated thread and some comments may be shown as answers.
Josh
Top achievements
Rank 1
Josh asked on 04 Nov 2009, 10:18 PM
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.

7 Answers, 1 is accepted

Sort by
0
Victor
Telerik team
answered on 05 Nov 2009, 03:00 PM
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.
0
MP
Top achievements
Rank 1
answered on 09 Nov 2009, 05:55 PM
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

0
Victor
Telerik team
answered on 16 Nov 2009, 11:58 AM
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.
0
Joe
Top achievements
Rank 1
answered on 18 Nov 2009, 11:34 AM
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...
0
Victor
Telerik team
answered on 18 Nov 2009, 05:20 PM
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.
0
superold
Top achievements
Rank 1
answered on 19 Nov 2009, 03:40 AM
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
0
Victor
Telerik team
answered on 23 Nov 2009, 09:10 AM
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.
Tags
Treeview
Asked by
Josh
Top achievements
Rank 1
Answers by
Victor
Telerik team
MP
Top achievements
Rank 1
Joe
Top achievements
Rank 1
superold
Top achievements
Rank 1
Share this question
or