Treeview - retrieving node in the Expand event

K

Kath

Hello

I'm having problems getting the correct node in the
expand event

If I use:
Dim CurrentNode As TreeNode
CurrentNode = sender.nodes(e.Node.ToString)

CurentNode is always the top node despite e.node.tostring
changing from 0 to 0.1 or 0.0

Is this a bug or am I doing something wrong?

Thanks Kath
 
A

Andy

Hi Kath,

you must recursively dig into the tree to get the selected
node.

For example your selectNodeIndex value might look
something like: 1.1.0

then using the following code i get the selected Node.

Dim IndexArr As Array = SelectedTreeIndex.Value.Split(".")
Dim Count As Integer
Dim Node As TreeNode

Node = Tree.Nodes(CInt(IndexArr(0)))
Node.Expanded = True

For Count = 1 To IndexArr.Length - 2
Node = Node.Nodes(CInt(IndexArr(Count)))
Node.Expanded = True
Next

(think this is correct anyhow)

Hope it helps

Andy

then using the
 
M

Manfred Braun

Hi All,

sorry for my additional question:Do I understand it right, that this code
snippet was for the server-side??

Thanks and best regards,
Manfred Braun

(Private)
Lange Roetterstrasse 7
D68167 Mannheim
Germany

mailto:[email protected]
(Remove the anti-spam-underscore to mail me!)
 
K

Kath

Hi Manfred

The control is set to runat server so I'm hopeful that this code will
run server side!

regards

Kath V
 

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

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top