473,396 Members | 1,879 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,396 software developers and data experts.

Treeview Node Type

Is there any way when progratically adding nodes to assign them some kind of
type group nodes that want to different things to. I am creating an Explorer
type interface and need to differentiate between folder and file nodes in my
code. Regards, Chris.
May 13 '06 #1
4 1771
You could subclass TreeNode.

Tom Dacon
Dacon Software Consulting

"Chris" <no****@btinternet.com> wrote in message
news:e2**************@TK2MSFTNGP03.phx.gbl...
Is there any way when progratically adding nodes to assign them some kind
of type group nodes that want to different things to. I am creating an
Explorer type interface and need to differentiate between folder and file
nodes in my code. Regards, Chris.

May 13 '06 #2
I'm not sure how you'd do that. Can you point me to any resouces/links?

"Tom Dacon" <td****@community.nospam> wrote in message
news:el**************@TK2MSFTNGP03.phx.gbl...
You could subclass TreeNode.

Tom Dacon
Dacon Software Consulting

"Chris" <no****@btinternet.com> wrote in message
news:e2**************@TK2MSFTNGP03.phx.gbl...
Is there any way when progratically adding nodes to assign them some kind
of type group nodes that want to different things to. I am creating an
Explorer type interface and need to differentiate between folder and file
nodes in my code. Regards, Chris.


May 13 '06 #3
I've done this sort of thing a variety of ways. The most flexibility
and less troublesome in regards to managing parent object references
if you do a bunch of drag and drop of tree nodes is do to
the following.

Create a simple class that has some sort of Guid or Unique ID, an
object name or possibly an enum, and a text description.

Store this object in the TreeNode.Tag property. Whenever
you get the selected node, grab the .Tag

CustomClass rob = (CustomClass)tree.SelectedNode.Tag;

--
Robbe Morris - 2004-2006 Microsoft MVP C#
Earn money answering .NET questions
http://www.eggheadcafe.com/forums/merit.asp

"Chris" <no****@btinternet.com> wrote in message
news:e2**************@TK2MSFTNGP03.phx.gbl...
Is there any way when progratically adding nodes to assign them some kind
of type group nodes that want to different things to. I am creating an
Explorer type interface and need to differentiate between folder and file
nodes in my code. Regards, Chris.

May 13 '06 #4
I can't seem to find the tag property. This is the asp.net v2 treeview. I
use the code below to add the node but I can't do e.g. newnode.tag =
"folder"

Dim newNode As TreeNode = New TreeNode("folder", "folder")

"Robbe Morris [C# MVP]" <in**@eggheadcafe.com> wrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
I've done this sort of thing a variety of ways. The most flexibility
and less troublesome in regards to managing parent object references
if you do a bunch of drag and drop of tree nodes is do to
the following.

Create a simple class that has some sort of Guid or Unique ID, an
object name or possibly an enum, and a text description.

Store this object in the TreeNode.Tag property. Whenever
you get the selected node, grab the .Tag

CustomClass rob = (CustomClass)tree.SelectedNode.Tag;

--
Robbe Morris - 2004-2006 Microsoft MVP C#
Earn money answering .NET questions
http://www.eggheadcafe.com/forums/merit.asp

"Chris" <no****@btinternet.com> wrote in message
news:e2**************@TK2MSFTNGP03.phx.gbl...
Is there any way when progratically adding nodes to assign them some kind
of type group nodes that want to different things to. I am creating an
Explorer type interface and need to differentiate between folder and file
nodes in my code. Regards, Chris.


May 14 '06 #5

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

Similar topics

4
by: Jeroen Ceuppens | last post by:
Hi, I want to make something that adds a TreeNode to the end of TreeView, that TreeView Looks like + Level 1 + Level 2 + Level 3 - Level last
2
by: George M. | last post by:
I'm working with the treeview control on an ASP.NET page (written in C#), and I have one built the looks something like: Root |_Category1 |_Site1 |_Report1 |_Report2 |_Site2 |_Report3...
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...
2
by: kevin | last post by:
I would like to remember the state of the nodes after the treeview gets disposed, but not necessarily after the app terminates so I don't need a disk file. I was thinking about using the tag...
1
by: Chris Murphy via DotNetMonster.com | last post by:
Hi all, I'm just wondering if any one can help me with this development issue I'm having. I've created a customized treeview control to handle the particular tasks to which I'll be using it. Within...
7
by: amruta | last post by:
the code below dows not let me get the parent child view... all the nodes are show in one line only... also i need them to be collasped ... Thanks ..
10
by: p3t3r | last post by:
I have a treeview sourced from a SiteMap. I want to use 2 different CSS styles for the root level nodes. The topmost root node should not have a top border, all the other root nodes should have a...
1
by: Christian Rühl | last post by:
hey! what i wanna do sounds very simple at first, but it turned out to be a real bone crusher... i want to check if a treeView node is checked and if a correspondent node in my xml config file...
1
by: Christian Rühl | last post by:
hey! what i wanna do sounds very simple at first, but it turned out to be a real bone crusher... i want to check if a treeView node is checked and if a correspondent node in my xml config file...
0
by: lewis76 | last post by:
I have figured out how to populate a treeview with an xml file however I just can't for the life of me get this formatting of the nodes right. Here's where I'm at: <Season>...
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
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...
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
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...
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.