Treeview Node Type

  • Thread starter Thread starter Chris
  • Start date Start date
C

Chris

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.
 
I'm not sure how you'd do that. Can you point me to any resouces/links?
 
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;
 
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")
 

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

Back
Top