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

RadTreeNode.Clone()

8 Answers 135 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
LFA
Top achievements
Rank 1
LFA asked on 26 Dec 2007, 09:14 PM
What happened to the Clone method? It is not mentioned in the radtree server api changes.

8 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 27 Dec 2007, 01:14 PM
Hi LFA,

The Clone method will be implemented for the service pack. It seems we have overlooked it - thanks for bringing this up.

Regards,
Albert
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Jonathan Simmons
Top achievements
Rank 1
answered on 01 Jan 2008, 11:53 PM
When will the Clone method and the service pack be available? This is a method I commonly use and I want to change a load of pages to use the Prometheus treeview.

Jonathan
0
LFA
Top achievements
Rank 1
answered on 02 Jan 2008, 05:35 AM
As a temporary fix I added RadTreeNode.Clone() using the new Extension Methods feature.
0
LFA
Top achievements
Rank 1
answered on 02 Jan 2008, 06:02 AM
Here you go. I added Remove() because it's also missing. Just import the MyExtensions namespace where you use Clone or Delete. I am not sure if the Clone method works exactly like the original. In my case it works. .NET 3.5 is required.

Imports System.Runtime.CompilerServices 
Imports Telerik.Web.UI 
Imports System.Reflection 
 
Namespace MyExtensions 
    Public Module TreeNodeExtensions 
        <Extension()> _ 
        Public Function Clone(ByVal node As RadTreeNode) As RadTreeNode 
            Dim copy As New RadTreeNode 
            For Each prop As PropertyInfo In GetType(RadTreeNode).GetProperties() 
                If prop.CanRead And prop.CanWrite Then 
                    prop.SetValue(copy, prop.GetValue(node, Nothing), Nothing
                End If 
            Next 
            Return copy 
        End Function 
 
        <Extension()> _ 
        Public Sub Remove(ByVal node As RadTreeNode) 
            If node.ParentNode Is Nothing Then 
                node.TreeView.Nodes.Remove(node) 
            Else 
                node.ParentNode.Nodes.Remove(node) 
            End If 
        End Sub 
    End Module 
End Namespace 


0
Jonathan Simmons
Top achievements
Rank 1
answered on 03 Jan 2008, 12:31 PM
LFA - Many thanks for this.
Regards,
Jonathan
0
BSolveIT
Top achievements
Rank 2
answered on 29 Jun 2008, 01:18 PM
Is the clone() method still not implemented?

Cheers
Mark
0
Simon
Telerik team
answered on 30 Jun 2008, 07:42 AM
Hi BSolveIT,

The server-side Clone has been implemented already.

Please download and install the latest version of RadControls for ASP.NET AJAX in order to take advantage of the method in your applications.

Kind regards,
Simon
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Bob
Top achievements
Rank 1
answered on 08 Aug 2008, 05:54 PM
Will there be a client version of the clone function?
Tags
TreeView
Asked by
LFA
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Jonathan Simmons
Top achievements
Rank 1
LFA
Top achievements
Rank 1
BSolveIT
Top achievements
Rank 2
Simon
Telerik team
Bob
Top achievements
Rank 1
Share this question
or