Treeview with images

2 posts, 1 answers
  1. cv
    cv avatar
    80 posts
    Member since:
    Mar 2007

    Posted 14 Oct 2008 Link to this post

    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.
  2. Answer
    Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 14 Oct 2008 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top