473,772 Members | 3,603 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_ SelectedNodeCha nged(object sender, EventArgs e)
{
string cssStyle = "color: #FFFFFF; background: none;
font-size:12pt;font-weight:bold;";
tvProgram.Selec tedNodeStyle.Cs sClass = cssStyle;
if (tvProgram.Sele ctedNode != null)
{
tvProgram.Selec tedNodeStyle.Ba ckColor = System.Drawing. Color.Beige;
tvProgram.Selec tedNode.Selecte d = false;
}
}

Jul 17 '08 #1
1 5742
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_ SelectedNodeCha nged(object sender, EventArgs e)
{
string cssStyle = "color: #FFFFFF; background: none;
font-size:12pt;font-weight:bold;";
tvProgram.Selec tedNodeStyle.Cs sClass = cssStyle;
if (tvProgram.Sele ctedNode != null)
{
tvProgram.Selec tedNodeStyle.Ba ckColor = System.Drawing. Color.Beige;
tvProgram.Selec tedNode.Selecte d = false;
}
}
Jul 18 '08 #2

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

Similar topics

1
2175
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 Control with checkbox)
6
14207
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 my database apps its common place to tell the user that they are working on record x of xxx records I'm trying to provide the same functionality using the tree control. TIA meh
5
5713
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 constantly being altered by user input. On upgrading the treeview errors are too numerous to list all of them. What has happened to 'Treeview1.nodes.add (ParentNode, Relation, NodeKey, Text)'? and Treeview1.nodes(NodeKey) Why is there no Node.Key? ...
7
2838
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 of custom, extended nodes, which include all the extra information contained in the table and not just typical TreeNode objects. To do that, I first created a structure with all the extra
3
2256
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 child node or a leaf node then a DataGrid is populated based on the node's ID property. If I expand a node then the DataGrid is not populated. This works fine. The problem is that this doesn't work if I collapse the tree. If I collapse the tree...
0
2297
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 clicks on a node to expand it. 2 - Add a child node to the node clicked by the user saying the tree is loading that part. So here, I also need to expand the node clicked by
1
4936
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 nodes 1 to 10, but when the user clicks , the tree will display nodes 11 to 20. Page 1 will is loaded when the page that contains the ascx (parent of the treeview) is loaded. This is all cool. The treeview displays correctly. When I click the ...
0
1152
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 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:...
3
4703
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 is if I close the application and then go back in, the nodes are back in the order they were before I had reordered them. Is there a way that I can modify my DragDrop event to permanently change the index of the nodes? Here's my code if you're...
0
9620
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9454
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10104
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8934
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7460
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4007
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2850
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.