Get All parents of selected nodes in asp.net 2.0 - John |
13-Mar-07 05:19:04
|
Hello Ted,
If "DDDD" is selected then:
tv.SelectedNode.Parent.Text returns "CCCC"
tv.SelectedNode.Parent.Parent.Text returns "BBBB"
tv.SelectedNode.Parent.Parent.Parent.Text returns "AAAA"
Is that what you're after?
Best regards
John |
 |
| |
Get All parents of selected nodes in asp.net 2.0 - Ted Ngo |
13-Mar-07 08:43:19
|
Yes, that is what I want, Thanks. But the problem is that the nodes
not always 4 levels, it different from nodes to nodes, I mean some
time it 5 levels, sometime 2, some 10 levels.
So I do it programmaticly.
I try this to get all the values of the nodes selected. (all it
parents)
string tst = tv.selectednodes.valuepath.
now which the values, can I get the nodes text. How.
Thanks |
 |
| |
Get All parents of selected nodes in asp.net 2.0 - John |
14-Mar-07 07:52:05
|
Do you mean:
tv.SelectedNode.FullPath
?
John |
 |
| |
Get All parents of selected nodes in asp.net 2.0 - Ted Ngo |
14-Mar-07 09:38:50
|
Here is path of my code:
protected void TreeNodeChanged(object sender, EventArgs e)
{
string [] nodepath;
string txt;
string txtofnodeselct;
txtofnodeselct = tv.SelectedNode.Text
txt = "";
nodepath = tv.SelectedNode.ValuePath.Split('/');
Now ny now nodepath have these nodes values:
nodepath[0] = "123"
nodepaht[1] = "456"
nodepath[2] = "893"
nodepath[3] = "442"
and so on
//now I loop through nodepath
foreach (string str in nodepath)
{
//my str will contain the value of the nodes
//How can I get the text of that node which the value node in the
//Please help.
}
}
Thanks |
 |
| |