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

Warning on Node.Parent and .Index

6 Answers 172 Views
Treeview
This is a migrated thread and some comments may be shown as answers.
Gourangi
Top achievements
Rank 1
Gourangi asked on 01 Jul 2008, 08:54 AM
Hi,

i am getting warning while accessing RadTreeNode's Parent and Index property that it is obsolete.

Can i have some replacement for this so those warning be removed ?

Thanks

6 Answers, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 03 Jul 2008, 11:43 AM
Hello Divyesh,

These properties are marked as obsolete because the setters of the Parent and Index properties will be removed. However, the getters will not be removed and you still will be able to get the needed value.

In case you are using the setters of these properties, here is how you should modify your code:
  1. Instead of radTreeNode2.Parent = radTreeNode1, you should add radTreeNode2 in the Nodes collection of radTreeNode1 using the Add method. Supposing that radTreeNode1 is the first node in the RadTreeNode.Nodes collection (i.e. with Index 0), the code is:
    this.radTreeView1.Nodes[0].Nodes.Add(radTreeNode2); 
  2. Instead of using radTreeNode2.Index = 1, you should insert the node in the Nodes collection (using the Insert method) and give the appropriate index:
    this.radTreeView1.Nodes.Insert(1, radTreeNode2); 
If you have additional questions, do not hesitate to contact me.

Best wishes,
Nikolay
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Gourangi
Top achievements
Rank 1
answered on 03 Jul 2008, 12:00 PM
hi,

i dont want to add/insert any node. i just want an index of particular node !

With Regards,

Divyesh
0
Nikolay
Telerik team
answered on 04 Jul 2008, 09:17 AM
Hello Divyesh,

The warning for the Index property will be removed once the setter of this property is removed. This will be addressed in one of our next versions.

If you have additional questions, feel free to contact me.

Sincerely yours,
Nikolay
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Gourangi
Top achievements
Rank 1
answered on 05 Jul 2008, 04:15 AM
Thank you Nikolay
0
William
Top achievements
Rank 1
answered on 16 Oct 2008, 02:39 PM
So just to be clear in the future this will work?

 

Dim node As RadTreeNode

 

node =

New RadTreeNode("Profile")

 

tvTreeView.Nodes.Add(node)

 

node = New RadTreeNode("Publications")

 

tvTreeView.Nodes.Add(node)

 

node = New RadTreeNode("New Publication")

 

tvTreeView.Nodes(

"Publications").Nodes.Add(node)

 

tvTreeView.ExpandAll()

0
Nikolay
Telerik team
answered on 20 Oct 2008, 04:06 PM
Hello William,

Correct. This code snippet will work in our future versions and you should have no worries about it. If you have additional questions, feel free to contact me further.

Best wishes,
Nikolay
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Treeview
Asked by
Gourangi
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
Gourangi
Top achievements
Rank 1
William
Top achievements
Rank 1
Share this question
or