Need assistance with RadTreeView and addinging images to node

1 Answer 69 Views
Treeview
Don
Top achievements
Rank 1
Don asked on 22 Jul 2023, 06:51 PM | edited on 22 Jul 2023, 07:02 PM

Hello All,

     I'm working on an active directory project where the RadTreeView requires it's nodes to have images according to the nodes respective containers (I.E. User Accounts will have an user icon). I have posted some code relating to my issue. I hope someone here can shed some light on this and tell me what it is I'm doing wrong.

To be clear on this, the nodes show active directory binded data but not the images. Thank you in advance.

 


        public void subEnumerateChildren(RadTreeNode oRootNode)
        {
            DirectoryEntry deParent = new DirectoryEntry("LDAP://RootDSE");


            foreach (DirectoryEntry deChild in deParent.Children)
            {
                RadTreeNode oChildNode = oRootNode.Nodes.Add(deChild.Path);
                switch (deChild.SchemaClassName)
                {
                    case "computer":
                        oChildNode.ImageIndex = 6;
                        break;
                    case "user":
                        oChildNode.ImageIndex = 7;
                        break;
                    case "group":
                        oChildNode.ImageIndex = 8;
                        break;
                    case "organizationalUnit":
                        oChildNode.ImageIndex = 3;
                        break;
                    case "container":
                        oChildNode.ImageIndex = 1;
                        break;
                    case "publicFolder":
                        oChildNode.ImageIndex = 5;
                        break;
                    default:
                        oChildNode.ImageIndex = 1;
                        break;
                }

                oChildNode.Tag = deChild;
                oChildNode.Text = deChild.Name.Substring(3).Replace("\\", "");

            }
        }

1 Answer, 1 is accepted

Sort by
0
Dinko | Tech Support Engineer
Telerik team
answered on 26 Jul 2023, 02:09 PM

Hello Don,

My name is Dinko and I will assist you today. Thank you for sharing your code snippet. While looking at it I can't see if the ImageList property of the RadTreeView is set. In order to set the images to nodes by only setting the ImageIndex, you need to assign your ImageList to RadTreeView so the images can be looked up. Can you double-check if the ImageList property is set correctly and hold the required images? 

radTreeView.ImageList= imageListCollection;

If this does not work, could it be possible to isolate your case in a standalone project so that I can take a look at your implementation?

I am looking forward to your reply.

Regards,
Dinko | Tech Support Engineer
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
Treeview
Asked by
Don
Top achievements
Rank 1
Answers by
Dinko | Tech Support Engineer
Telerik team
Share this question
or