473,394 Members | 1,738 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Changing the Previous Treeview node back color

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

Jul 17 '08 #1
1 5730
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)
Mike Collins wrote:
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;
}
}
Jul 18 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Srinivasa Raghavan | last post by:
Hi All, I have some doubts on the Treeview control and Form Authentication 1) will Form Authentication work if cookies are disabled. 2) I have problem in the following code (TreeView...
6
by: meh | last post by:
I can figure out the total number of nodes in a given tree but what I'd like to know is what is the Selected Nodes relationship to the entire tree i.e This is node n out of nnn nodes. In most of...
5
by: JamesT | last post by:
Is it me or has the VB.NET Treeview control gone back to the darkages. I am trying to update a VB6 programme that uses the treeview control a lot- there are 4 treeview controls which are...
7
by: vsiat | last post by:
I am trying to create a treeview out of a database table with the typical structure ID, NAME, PARENTID, TYPE, EXTRA_INFO, where is linked to the . What I want to achieve is create a tree made...
3
by: Shawn | last post by:
Hi. I'm working with the TreeView control in my ASP.NET 1.1 application. I have a problem I haven't been able to figure out. When I click on a node (not expand), whether it's a parent node, a...
0
by: drop | last post by:
Hi, I'm currently working with the Treeview control in ASP .Net 2.0. The tree is filled dynamically based on data contained in a MySQL Database. Here is the exact behavior I want : 1 - User...
1
by: doemon | last post by:
Hi, I'm working on a pagination control and I need to dynamically rerender a treeview to display the next set of nodes depending on which page we're on. For example, page 1 will dispaly only...
0
by: =?Utf-8?B?TWlrZSBDb2xsaW5z?= | last post by:
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...
3
by: dutsnekcirf | last post by:
I have a treeview control on a custom task pane in Excel. I've enable the ability to use Drag & Drop (by following this how-to) on the treeview to change the order of the nodes. The problem though...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.