Set image for rad tree node depending on its attribute using css

2 posts, 0 answers
  1. Vitalii
    Vitalii avatar
    9 posts
    Member since:
    Jan 2013

    Posted 30 Jan 2013 Link to this post

    Hello Telerik!

    I have my RadTreeView:

    <telerik:RadTreeView runat="server" ID="TreeViewUnit"  CssClass="TreeView"
               ShowLineImages="False" Skin="Forest"


    And I have binding in code behind where I set two attributes:
    item.Attributes["Item"] = "Unit";
    item.Attributes["Item"] = "Respondent";

    Also I set node images in code behind and it's bad.
    item.ImageUrl = imageFolder + "folder-icon.png";
    node.ImageUrl = imageFolder +

    So I want to do it right way in order to reduce traffic and use CSS for node image.
    I tried:

    .RadTreeView .rtImg {
        background-image: url("/Styles/images/plusminus_icon.png") !important;
    .RadTreeView_Forest .rtImg {
        background-image: url("/Styles/images/profile_icon.png") !important;

    but it does not work.

    For example:
    .RadTreeView_Forest .rtPlus, .RadTreeView_Forest .rtMinus {
        background-image: url("/Styles/images/plusminus_icon.png") !important;

    works perfectly fine for minus sign images.

    Any ideas how can I do it? And It will be great if there was a way to select image depending on node attribute. I think I can manage to do it using javascript and DOM elements, but adding images using CSS still a question.

  2. Vitalii
    Vitalii avatar
    9 posts
    Member since:
    Jan 2013

    Posted 05 Feb 2013 Link to this post

    Still interesting, any ideas how can it be done via client side?
Back to Top