Re: XML TreeNode.Parent property when using 2.0 TreeView?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



"clintonG" <csgallagher@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:%23erL6WOXFHA.3532@xxxxxxxxxxxxxxxxxxxxxxx
> How do I get a TreeNode.Parent property when using the 2.0 TreeView
> control?
>
> When the data source is an XML file there may be redundant names in the
> tree. For example, when a child node with the value of 'name' is selected
> I
> don't have a clue how to get the name of its parent which may be 'student'
> or
> 'school.'
>
> <%= Clinton Gallagher

One mystery solved...

if(treeView1.SelectedNode.Parent.Depth != -1)
{
lblSelectedNode.Text =
"Parent Node: " + treeView1.SelectedNode.Parent.Text + " " +
"SelectedNode: " + treeView1.SelectedNode.Value.ToString() + " " +
}
else
{
// do something else here
}

Now the next mystery is how to determine *which* parent and child have been
selected when there are multiple parents and children all of which are
redundantly named...

<school>
<name>School of Hard Knocks</name>
<student>
<name>John</name>
</student>
<student>
<name>Jane</name>
</student>
</school>

For example, when the <name> node with value of John is selected I can now
get and pass the values from the parent <student> and the child <name> nodes
as &parent=student&name=John easily enough but I'm wondering if that's the
smartest way to identify the group of nodes in a tree or if there is some
indexing methodology that would be more efficient, more readable, and not
require what it seems will require a quite lengthy switch statement in the
page that receives the passed QueryString values.

For example, the example tree shown above is simplified. The actual parent
<student> will have several children such as <name>,<age>, <sex> and
possibly other child nodes for example. The root node <school> will have
multiple instances of the <student> nodes.

What I am working on is the use of a tree that can allow a node to be
selected and then passed to a page where textboxes can be used to populate
the node with data or edit the existing data for the node. I need help
understanding how to explicilty identify which parent-child nodes have been
selected when the tree contains redundantly named instances.

Comments?

<%= Clinton Gallagher


.



Relevant Pages

  • RE: Add Child Node to Treeview
    ... thinking yesterday afternoon that perhaps one way to get a unique strKey is ... into the!Parent section. ... 'Fill Tree ... qryFamTree has my main table joined to a second table by WhoID. ...
    (microsoft.public.access.formscoding)
  • Re: How to populate a treeview from a dataset
    ... If it is then check to see if the parentId and child id of the ... 15 is a parent and a child of itself. ... And that same business is the headquarters for the purchasing group. ... 15 Null - root tree node, ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: How to populate a treeview from a dataset
    ... If it is then check to see if the parentId and child id of the ... 15 is a parent and a child of itself. ... And that same business is the headquarters for the purchasing group. ... 15 Null - root tree node, ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Add Child Node to Treeview
    ... You cannot use the same value for strKey for multiple nodes. ... even though they refer to the same child. ... When I base the tree on this query I get ... 'Find the parent node and add it below that node's last child ...
    (microsoft.public.access.formscoding)
  • [git pull] jfs update
    ... commit c5111f504d2a9b0d258d7c4752b4093523315989 ... tree 6a52864aff79691689aea21cb0cb928327d5de5b ... parent 69eb66d7da7dba2696281981347698e1693c2340 ... JFS: Take logsync lock before testing mp->lsn ...
    (Linux-Kernel)