This is a migrated thread and some comments may be shown as answers.

RadTreeNode with Image

3 Answers 199 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Venkata
Top achievements
Rank 1
Venkata asked on 14 Jan 2015, 08:41 PM
Hello,
I want to create TreeNodes with images(NodeText + Image)
Here is something like...
Private void LoadNodes()
{
  RadTreeView.Nodes.Clear();
  RadTreeNode node1 = new RadTreeNode();
  node1 = new RadTreeNode("Node Text" + Image with client Click event, "Node Value")                       node1 .Attributes.Add("IsFirstLevel", "Yes");                                                                                         RadTreeView.Nodes.Add(node1 );
}

How can i do?

3 Answers, 1 is accepted

Sort by
0
Ivan Danchev
Telerik team
answered on 15 Jan 2015, 01:14 PM
Hello,

If you want to add a new child node with an image and text displayed you can do the following:

protected void Page_Load(object sender, EventArgs e)
{
    if (!Page.IsPostBack)
    {
        RadTreeNode root1 = new RadTreeNode("root1");
        RadTreeNode root2 = new RadTreeNode("root2");
        RadTreeNode child1 = new RadTreeNode("child1");
        child1.ImageUrl = "~/Images/telerik.png";
        root2.Nodes.Add(child1);
        RadTreeView1.Nodes.Add(root1);
        RadTreeView1.Nodes.Add(root2);
    }
}

This creates two root items and adds a child item to "root2", passing the image path to the ImageUrl property of "child1". Then we add the root items to the RadTreeView control.

Regards,
Ivan Danchev
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Venkata
Top achievements
Rank 1
answered on 16 Jan 2015, 09:47 PM
Hello,
I know that is the simple way display Image + Text 

But my question was, I want to Text First then Image ( Text + Image). add Onlick client event to Image 

Thank you
0
Ivan Danchev
Telerik team
answered on 19 Jan 2015, 09:53 AM
Hello,

The following forum discussion shows how you can change the place of the image using jQuery with RadTreeView control.

Regards,
Ivan Danchev
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
TreeView
Asked by
Venkata
Top achievements
Rank 1
Answers by
Ivan Danchev
Telerik team
Venkata
Top achievements
Rank 1
Share this question
or