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

Custom images for the root items

2 Answers 47 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Jon
Top achievements
Rank 1
Jon asked on 19 Nov 2008, 01:54 PM
Hi,

VB - Q3

I am binding the tree to an hierarchical table which also has a field called 'imagePath.' I use the image path in the NodeDataBound event to show the different icons for each node.
However, for the root nodes, I only seem to be able to use the 'ImageURL' and SelectedImageURL' for these icons.

 Can I assign these custom images from the DB field 'imagePath' ?

Many thanks,

Jon 

2 Answers, 1 is accepted

Sort by
0
Accepted
Atanas Korchev
Telerik team
answered on 20 Nov 2008, 05:55 PM
Hi jon byron,

I am not sure what the problem is. Could you please elaborate? What do you mean by saying that you are able to use the ImageUrl and SelectedImageUrl for root nodes? Those properties are available for all nodes.

Regards,
Albert
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Jon
Top achievements
Rank 1
answered on 25 Nov 2008, 04:49 AM

Dear Albert,

 

Sorry for the delay and thanks for the reply.

Sometimes the easiest things are the hardest to spot - doh!
I just used this...

 

Protected Sub RTV1_NodeDataBound(ByVal sender As Object, ByVal e As RadTreeNodeEventArgs) Handles RTV1.NodeDataBound  
 
        ' brings the image path from the database  
        Dim _iPath As String = (TryCast(e.Node.DataItem, DataRowView))("imagepath").ToString()  
        e.Node.ImageUrl = "~/images/tree/" & _iPath  
 
    End Sub 'RTV1_NodeDataBound  
 

Cheers,
Jon
Tags
TreeView
Asked by
Jon
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Jon
Top achievements
Rank 1
Share this question
or