473,324 Members | 2,248 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,324 software developers and data experts.

Get All parents of selected nodes in asp.net 2.0

Hi All,

I am using treeview control in asp.net 2.0.
this is my treeview:

ZZZZZ
NNNNNN
HHHHHHH
KKKKKKK
AAAA
BBBB
CCCC
DDDD
LLLLL
11111
22222
333333
XXXXX
12345
5678
YYYYY

if I selected "DDDD" node, I would get to get all the parents text of
the "DDDD" node
I want to get back "CCCC", "BBBB", "AAAA"

I am using this to get "DDDD" node text back "tv.SelectedNode.Text"
And I am using this to get "CCCC" node text back
tv.SelectedNode.Parent.Text but I am not sure how to get BBBB and AAAA
text back.

Please help.

Thanks in advance

Mar 13 '07 #1
4 1857
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
"Ted Ngo" <nt******@yahoo.comwrote in message
news:11**********************@n59g2000hsh.googlegr oups.com...
Hi All,

I am using treeview control in asp.net 2.0.
this is my treeview:

ZZZZZ
NNNNNN
HHHHHHH
KKKKKKK
AAAA
BBBB
CCCC
DDDD
LLLLL
11111
22222
333333
XXXXX
12345
5678
YYYYY

if I selected "DDDD" node, I would get to get all the parents text of
the "DDDD" node
I want to get back "CCCC", "BBBB", "AAAA"

I am using this to get "DDDD" node text back "tv.SelectedNode.Text"
And I am using this to get "CCCC" node text back
tv.SelectedNode.Parent.Text but I am not sure how to get BBBB and AAAA
text back.

Please help.

Thanks in advance

Mar 13 '07 #2
On Mar 13, 4:19 pm, "John" <JohnSickOfS...@AOL.netwrote:
Hello Ted,

If "DDDD" isselectedthen:
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

"Ted Ngo" <ntuye...@yahoo.comwrote in message

news:11**********************@n59g2000hsh.googlegr oups.com...
HiAll,
I am using treeview control inasp.net2.0.
this is my treeview:
ZZZZZ
NNNNNN
HHHHHHH
KKKKKKK
AAAA
BBBB
CCCC
DDDD
LLLLL
11111
22222
333333
XXXXX
12345
5678
YYYYY
if Iselected"DDDD" node, I wouldgettogetalltheparentstext of
the "DDDD" node
I want togetback "CCCC", "BBBB", "AAAA"
I am using this toget"DDDD" node text back "tv.SelectedNode.Text"
And I am using this toget"CCCC" node text back
tv.SelectedNode.Parent.Text but I am not sure how togetBBBB and AAAA
text back.
Please help.
Thanks in advance- Hide quoted text -

- Show quoted text -
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

Mar 14 '07 #3
Do you mean:

tv.SelectedNode.FullPath

?

John

"Ted Ngo" <nt******@yahoo.comwrote in message
news:11*********************@o5g2000hsb.googlegrou ps.com...
On Mar 13, 4:19 pm, "John" <JohnSickOfS...@AOL.netwrote:
>Hello Ted,

If "DDDD" isselectedthen:
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

"Ted Ngo" <ntuye...@yahoo.comwrote in message

news:11**********************@n59g2000hsh.googleg roups.com...
HiAll,
I am using treeview control inasp.net2.0.
this is my treeview:
ZZZZZ
NNNNNN
HHHHHHH
KKKKKKK
AAAA
BBBB
CCCC
DDDD
LLLLL
11111
22222
333333
XXXXX
12345
5678
YYYYY
if Iselected"DDDD" node, I wouldgettogetalltheparentstext of
the "DDDD" node
I want togetback "CCCC", "BBBB", "AAAA"
I am using this toget"DDDD" node text back "tv.SelectedNode.Text"
And I am using this toget"CCCC" node text back
tv.SelectedNode.Parent.Text but I am not sure how togetBBBB and AAAA
text back.
Please help.
Thanks in advance- Hide quoted text -

- Show quoted text -

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

Mar 14 '07 #4
On Mar 14, 7:52 am, "John" <JohnSickOfS...@AOL.netwrote:
Do you mean:

tv.SelectedNode.FullPath

?

John

"Ted Ngo" <ntuye...@yahoo.comwrote in message

news:11*********************@o5g2000hsb.googlegrou ps.com...
On Mar 13, 4:19 pm, "John" <JohnSickOfS...@AOL.netwrote:
Hello Ted,
If "DDDD" isselectedthen:
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
"Ted Ngo" <ntuye...@yahoo.comwrote in message
>news:11**********************@n59g2000hsh.googleg roups.com...
HiAll,
I am using treeview control inasp.net2.0.
this is my treeview:
ZZZZZ
NNNNNN
HHHHHHH
KKKKKKK
AAAA
BBBB
CCCC
DDDD
LLLLL
11111
22222
333333
XXXXX
12345
5678
YYYYY
if Iselected"DDDD" node, I wouldgettogetalltheparentstext of
the "DDDD" node
I want togetback "CCCC", "BBBB", "AAAA"
I am using this toget"DDDD" node text back "tv.SelectedNode.Text"
And I am using this toget"CCCC" node text back
tv.SelectedNode.Parent.Text but I am not sure how togetBBBB and AAAA
text back.
Please help.
Thanks in advance- Hide quoted text -
- Show quoted text -
Yes, that is what I want, Thanks. But the problem is that thenodes
not always 4 levels, it different fromnodestonodes, I mean some
time it 5 levels, sometime 2, some 10 levels.
So I do it programmaticly.
I try this togetall the values of thenodesselected. (all it
parents)
string tst = tv.selectednodes.valuepath.
now which the values, can Igetthenodestext. How.
Thanks- Hide quoted text -

- Show quoted text -

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
"str"
//Please help.

}

}

Thanks

Mar 14 '07 #5

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

Similar topics

1
by: Ones Self | last post by:
Hi, I have a tree structure which is maintained through the use of a path enumerated column: CREATE TABLE items ( item_id NUMERIC NOT NULL, path VARCHAR2(64) NOT NULL );
0
by: Mike | last post by:
Hello All, I wrote a function that will create a file system directory for my web application and display it in the IE Treeview control. Everything wrotes great! What I'm having trouble with is...
2
by: worzel | last post by:
Can't suss this out for the life of me, googling of no help either. Okay, new to win forms; I have a treeview with several root nodes, each having a single level of child nodes underneath. I also...
3
by: Manish Jain | last post by:
Platform: C# Windows Application/Framework 1.1 ---------------------------------------------------- I am implementing Drag' Drop between 2 trees. Now when I initiate drag and "DragOver" the...
1
by: James L | last post by:
Hi, I have a treeview that has to be refreshed due to data changes. Is it possible to select the last node that they were viewing when the tree view was been populated once again? I have...
2
by: rfm | last post by:
I have a TreeView with 1 expanded top node, it has several childnodes (call it row A), which have childs of their own. The top node is selected correctly and all childnodes from the row A nodes...
1
by: Falcula | last post by:
Hello, I have a treeview control, when i select a item i navigate to url. But selected node is lost, it reset itself, loosing state. I post my code here. Thanks in advance. <script...
0
by: divya1949 | last post by:
Create a windows c# application which will Read a xml file and populate nodes in the treeview. 1 On selection of treenode display the child nodes of that node in listview control 2. ...
3
by: =?Utf-8?B?TWFyaw==?= | last post by:
In Visual Basic 2008 how do I programmatically set a node to selected? For example, my treeview has several nodes with dates, and I want set one of the dates as selected because it happens to...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.