We help IT Professionals succeed at work.

Setting Custom Images (ImageSet) for TreeView Control

wmhogg
wmhogg asked
on
4,665 Views
Last Modified: 2008-07-24
Hi,

I am creating an ASP.NET 2.0 web part that will be used in SharePoint in the Page Load event.  I currently have the TreeView working with the following code:

            TreeView1 = new TreeView();
           
            TreeView1.ShowLines = true;
            TreeView1.ShowExpandCollapse = true;
            TreeView1.ImageSet = TreeViewImageSet.XPFileExplorer;
           
            Controls.Add(TreeView1);

However, I would like to use custom images (i.e. SharePoint icons) for the Parent and Child nodes.   Keeping in mind that I don't have an ASPX page or access to a Properties Window in the web part, could you please provide me with some sample C# code as to how to set the Parent and Child Nodes' icons?

Thanks,

William
Comment
Watch Question

CERTIFIED EXPERT
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.