Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read SiteMap

Tags: , , , , ,

Sponsored Links



How to add an Image to a parent node in a treeview?

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 27-01-2010
Member
 
Join Date: Dec 2009
Posts: 24
How to add an Image to a parent node in a treeview?

Hi all,
I am IT student and I work on project in that project I want to make tree view but my client requirement is he want image on parent node of the treeview. But I don’t how to add an Image to a parent node in a tree view?, for that I asking you, I try so many things to add image but all are fails and because of this I ask you please give some useful suggestions.
Thank you.
Reply With Quote
  #2  
Old 27-01-2010
Praetor's Avatar
Member
 
Join Date: Apr 2008
Posts: 1,937
Re: How to add an Image to a parent node in a treeview?

Hey I think for solving your problem you have to use following code. Using this code you able to add image in your treeview.
Dim parnod As Node

Quote:
Set YAHOO.widget.TextNode.ImageList = Imgls

Set parnod = YAHOO.widget.TextNode.Nodes.Add(, , "Root", "Root Node","Closed")

parnod.ExpandedImage = "Open"
parnod.Expanded = True

Set parnod = YAHOO.widget.TextNode.Nodes.Add("Root", tvwChild, "Child1", "Child node 1", "Closed")

parnod.ExpandedImage = "Open"
parnod.Expanded = True

Set parnod = YAHOO.widget.TextNode.Nodes.Add("Root", tvwChild, "Child2", _
"Child node 2", "Leaf")
Set parnod = YAHOO.widget.TextNode.Nodes.Add("Root", tvwChild, "Child3", _
"Child node 3", "Leaf")
Reply With Quote
  #3  
Old 27-01-2010
kelfro's Avatar
Member
 
Join Date: Apr 2008
Posts: 1,976
Re: How to add an Image to a parent node in a treeview?

Hey I think you in your question you not define in which language you develop your application, because of this I am not able to understand in which language code I past , but then also I give you solution in ASP language if you able clearly understand the logic behind this code then I think you able to write code in any language

Using following code you able to add Images for Root, Parent, and Leaf Nodes
Quote:
<asp:TreeView ID="YAHOO.widget.TextNode" runat="server" DataSourceID="XmlDataSource1" >
<RootNodeStyle ImageUrl="~/Images/root.gif" />
<ParentNodeStyle ImageUrl="~/Images/parent.gif" />
<LeafNodeStyle ImageUrl="~/Images/leaf.gif" />
</asp:TreeView>
Reply With Quote
  #4  
Old 27-01-2010
Zecho's Avatar
Member
 
Join Date: May 2008
Posts: 2,267
Re: How to add an Image to a parent node in a treeview?

Here I share some CSS code for adding images on your treeview with help of yahoo widget, I think this will very help code for you it is easy to understand.

Quote:
var tree = new YAHOO.widget.TextNode("tdiv");
var root = tree.getRoot();
var parnod = new Txtnod("Parent Node", root, true);
var child11= new Txtnod("child1", parnod, false);
child11.labelStyle = "icon-doc";
var child12= new Txtnod("child2", parnod, false);
child12.labelStyle = "icon-ppt";
var child13= new Txtnod("child3", parnod, false);
child13.labelStyle = "icon-prv";
Reply With Quote
  #5  
Old 27-01-2010
absolute55's Avatar
Member
 
Join Date: Nov 2005
Posts: 1,238
Re: How to add an Image to a parent node in a treeview?

If you use ASP.net then use following steps, in this ASP.net you need not to write code for this because of Microsoft Visual Web Developer,
Use following steps to add image in your treeview
1. In Microsoft Visual Web Developer open an existing ASP.NET page.
2. Select the Design view.
3. Using the Navigation tab, drag a TreeView control onto the page.
4. Right-click the control and click Show Smart Tag.
5. After that TreeView Tasks window is displayed.
6. Click Customize Line Images.
Reply With Quote
Reply

  TechArena Community > Software > Software Development


Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "How to add an Image to a parent node in a treeview?"
Thread Thread Starter Forum Replies Last Post
Treeview in VBA in Excel The-Farmer MS Office Support 3 2 Weeks Ago 03:49 PM
What are parent::construct() and parent::destruct() in PHP? warehouse peon Software Development 5 06-03-2010 07:11 AM
Features of Flexible TreeView michaels Windows Software 5 22-01-2010 05:32 AM
Converting CDATA Node into Text Node Jagdish Gada Software Development 3 07-12-2009 09:54 AM
How to Highlight TreeView.SelectedNode in VB.Net Pratyush Software Development 3 03-03-2009 03:10 PM


All times are GMT +5.5. The time now is 05:18 AM.