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

Overriding RadTreeNode & RadTreeNodeData

1 Answer 98 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Jonathan
Top achievements
Rank 1
Jonathan asked on 14 May 2009, 05:51 PM
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

1 Answer, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 15 May 2009, 11:32 AM
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.
Tags
TreeView
Asked by
Jonathan
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Share this question
or