ASP.NET 3.5 and above only

ASP.NET TreeView - Customizing TreeView Images

You can use custom images to indicate an expandable node, a collapsible node, or a leaf node that does not expand or collapse. Also each node can have an image which is rendered to the left of the node text.

  • All Contacts (3/3)
    • Nancy Davolio
    • Janet Liverling
    • Margaret Peacock
  • Home (1/1)
    • Andrew Fuller
  • Office (2/2)
    • Laura Callahan
    • Steven Buchanan

[C#]

            //Set custom node expand icon
            this.ObTree.ExpandImageUrl   = "~/obout.ajax.ui/treeview/examples/img/exp_msn.gif";
            //Set custom node collapse icon
            this.ObTree.CollapseImageUrl = "~/obout.ajax.ui/treeview/examples/img/col_msn.gif";
            //Set custom leaf node icon
            this.ObTree.LeafNodeImageUrl = "~/obout.ajax.ui/treeview/examples/img/leaf_msn.gif";
            
            //Set custom node icon
            node.ImageUrl ="~/obout.ajax.ui/treeview/examples/img/info.png";
            
[VB]

           'Set custom node expand icon
            Me.ObTree.ExpandImageUrl = "~/obout.ajax.ui/treeview/examples/img/exp_msn.gif"
            'Set custom node collapse icon
            Me.ObTree.CollapseImageUrl = "~/obout.ajax.ui/treeview/examples/img/col_msn.gif"
            'Set custom leaf node icon
            Me.ObTree.LeafNodeImageUrl = "~/obout.ajax.ui/treeview/examples/img/leaf_msn.gif"

            'Set custom node icon
            node.ImageUrl ="~/obout.ajax.ui/treeview/examples/img/info.png"
            

"Perfect! Honestly, you guys make me look brilliant. Your components offer a dynamic, and professionally designed experience for my users. The TreeView has been invaluable to me, huge datasets and enormous hierarchies are a snap. However, when you first introduced the CALLBACK, you rocked my world! Having moved from desktop to web applications, I missed the functionality I used to have. You gave it back - thank you. I can't tell you the number of times I've been asked "How'd you do that?" (even from our tech support and contractors)."

John Cappelletti

Random testimonial   All testimonials