Changing the Previous Treeview node back color

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?

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;
}
}
 
B

bruce barker

yes. just selecting a node in another tree will not deselect a node in
the current tree. your code will have to determine which tree did the
postback. although for performance you should do this in javascript
rather than via a postback.

-- bruce (sqlwork.com)
 

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

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top