Changing Treeview property

M

Mike Collins

I have six treeviews on a page. Each one is nested inside an accordion pane.
When I click on a node, it turns yellow. When I click on a node in another
tree, I would like the previous selected node to change back from yellow to
its original color. The two different ways I have tried below do not work. Am
I doing something wrong?

Code:
protected void tvAccountSetup_SelectedNodeChanged(object sender, EventArgs e)
{
    string cssStyle = "color: #FFFFFF; background: none; 
font-size:12pt;font-weight:bold;";
    tvProgram.SelectedNodeStyle.CssClass = cssStyle;
    if (tvProgram.SelectedNode != null)
    {
        tvProgram.SelectedNodeStyle.BackColor = System.Drawing.Color.Beige;
        tvProgram.SelectedNode.Selected = false;
    }
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,050
Latest member
AngelS122

Latest Threads

Top