Overriding RadTreeNode & RadTreeNodeData

2 posts, 0 answers
  1. Jonathan
    Jonathan avatar
    22 posts
    Member since:
    Oct 2006

    Posted 14 May 2009 Link to this post

    Hi,

    I am working on a tree that has potentional to become very large indeed, but also uses images for each node.
    The first level nodes are loaded on page load with further loads being loaded via a ajax Wcf Service

    To get the most out of the available bandwidth I have extended RadTreeNode overriding the RenderContents method and adding an ImageCssClass property. The new RenderContents method injects the ImageCssClass string into the HtmlTextWriter to set the image via CSS rather than specifying a url for each node.

    The CSS classes all use a single png file as a background image and use the background position trick to show only the required image.

    This works very well for RadTreeNode, my problem is that RadTreeNodeData returned by the Wcf Service is (from what I understand) processed client-side and there is no server-side RenderContents method to override.

    I assume there is a javascript method that dynamically adds the nodes to the tree.

    Can you point me at this method and maybe suggest the best way to override it?
    Also when I inherit from the RadTreeNodeData class to add my ImageCssClass property the webservice load fails, I guess this is because the type structure received client-side is not waht is expected?

    Thanks
  2. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 15 May 2009 Link to this post

    Hello Jonathan,

    Unfortunately overriding the client-side rendering is not supported at the moment. You can however subscribe to the OnClientNodeDataBound event and customize the node as you wish (set image url for example). Extending RadTreeNode data should be trivial - inherit from the class, apply the DataContract attribute to that calss and DataMember attribute to your custom property.

    Regards,
    Albert
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Back to Top