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

Treeview with images

1 Answer 106 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
cv
Top achievements
Rank 1
cv asked on 14 Oct 2008, 06:14 AM
hi,

I am using treeview in my page, i need to generate treeview with different images based on the condition.

how can i do this...

pls tell me the solution.

1 Answer, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 14 Oct 2008, 06:55 AM
Hi,

You can use the ImageUrl property of the tree node to set the images conditionally.

CS:
 protected void RadTreeView1_PreRender(object sender, EventArgs e) 
    { 
        foreach (RadTreeNode TreeNode in RadTreeView1.Nodes) 
        { 
            if (TreeNode.Text == "America") 
            { 
                TreeNode.ImageUrl = "Images/Pic3.gif"
            } 
            else if (TreeNode.Text == "Italy") 
            { 
                TreeNode.ImageUrl = "Images/Pic4.gif"
            } 
        } 
    } 


Thanks
Shinu.
Tags
TreeView
Asked by
cv
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or