Custom images for the root items

3 posts, 1 answers
  1. Jack
    Jack avatar
    128 posts
    Member since:
    May 2003

    Posted 19 Nov 2008 Link to this post

    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. Answer
    Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 20 Nov 2008 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Jack
    Jack avatar
    128 posts
    Member since:
    May 2003

    Posted 24 Nov 2008 Link to this post

    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
Back to Top