RadTreeNode.Clone()

9 posts, 0 answers
  1. LFA
    LFA avatar
    11 posts
    Member since:
    Mar 2007

    Posted 26 Dec 2007 Link to this post

    What happened to the Clone method? It is not mentioned in the radtree server api changes.
  2. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 27 Dec 2007 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Jonathan Simmons
    Jonathan Simmons avatar
    108 posts
    Member since:
    Jun 2005

    Posted 01 Jan 2008 Link to this post

    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
  5. LFA
    LFA avatar
    11 posts
    Member since:
    Mar 2007

    Posted 01 Jan 2008 Link to this post

    As a temporary fix I added RadTreeNode.Clone() using the new Extension Methods feature.
  6. LFA
    LFA avatar
    11 posts
    Member since:
    Mar 2007

    Posted 02 Jan 2008 Link to this post

    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 


  7. Jonathan Simmons
    Jonathan Simmons avatar
    108 posts
    Member since:
    Jun 2005

    Posted 03 Jan 2008 Link to this post

    LFA - Many thanks for this.
    Regards,
    Jonathan
  8. BSolveIT
    BSolveIT avatar
    49 posts
    Member since:
    Aug 2006

    Posted 29 Jun 2008 Link to this post

    Is the clone() method still not implemented?

    Cheers
    Mark
  9. Simon
    Admin
    Simon avatar
    2281 posts

    Posted 30 Jun 2008 Link to this post

    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
  10. Bob
    Bob avatar
    55 posts
    Member since:
    Apr 2008

    Posted 08 Aug 2008 Link to this post

    Will there be a client version of the clone function?
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017