473,487 Members | 2,680 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Treeview and click on + to expand node

Hi I have a little problem with Treeview expand.
So I'll try to explain.

I Have one node and some subnodes like this

+Nodes1
|------Subnodes 1
|------Subnodes 2

+Nodes2
|------Subnodes 3
|------Subnodes 3

and so on....
Well if Nodes2 is selected, and I'll click on + Nodes1,in the
AfterExpand and AfterCollapse event I'll got handle for Nodes2 (the
selected one) and not for the clicked one on + to expand.
I need to get the handle for node wich i clicked + and no the selected
one.
Is there a way to do what I need?

Many Thanks
Jun 27 '08 #1
4 7441
On May 15, 12:17 am, Marcolino <marco.pozzu...@gmail.comwrote:
Hi I have a little problem with Treeview expand.
So I'll try to explain.

I Have one node and some subnodes like this

+Nodes1
|------Subnodes 1
|------Subnodes 2

+Nodes2
|------Subnodes 3
|------Subnodes 3

and so on....
Well if Nodes2 is selected, and I'll click on + Nodes1,in the
AfterExpand and AfterCollapse event I'll got handle for Nodes2 (the
selected one) and not for the clicked one on + to expand.
I need to get the handle for node wich i clicked + and no the selected
one.
Is there a way to do what I need?

Many Thanks
Marcolino,
I tried to understand your issue and i hope adding these 2 events will
do what you want:

' Select node that's expanded
Private Sub TreeView1_AfterExpand(ByVal sender As System.Object, ByVal
e As System.Windows.Forms.TreeViewEventArgs) Handles
TreeView1.AfterExpand
TreeView1.SelectedNode = e.Node
End Sub

' Select node that's collapsed
Private Sub TreeView1_AfterCollapse(ByVal sender As System.Object,
ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles
TreeView1.AfterCollapse
TreeView1.SelectedNode = e.Node
End Sub

and TreeView1 is your TreeView control of course.

Hope this helps,

Onur Güzel
Jun 27 '08 #2
"Marcolino" <ma************@gmail.comschrieb
Hi I have a little problem with Treeview expand.
So I'll try to explain.

I Have one node and some subnodes like this

+Nodes1
|------Subnodes 1
|------Subnodes 2

+Nodes2
|------Subnodes 3
|------Subnodes 3

and so on....
Well if Nodes2 is selected, and I'll click on + Nodes1,in the
AfterExpand and AfterCollapse event I'll got handle for Nodes2 (the
selected one) and not for the clicked one on + to expand.
I need to get the handle for node wich i clicked + and no the
selected one.
Is there a way to do what I need?

Works for me. I always get the expanded/collapsed node. How do you
identify the node? It's in e.Node (e being one argument of the event
handler).
Armin

Jun 27 '08 #3
On 14 Mag, 23:54, kimiraikkonen <kimiraikkone...@gmail.comwrote:
On May 15, 12:17 am, Marcolino <marco.pozzu...@gmail.comwrote:


Hi I have a little problem with Treeview expand.
So I'll try to explain.
I Have one node and some subnodes *like this
+Nodes1
|------Subnodes 1
|------Subnodes 2
+Nodes2
|------Subnodes 3
|------Subnodes 3
and so on....
Well if Nodes2 is selected, and I'll click on + Nodes1,in the
AfterExpand and AfterCollapse event I'll got handle for Nodes2 (the
selected one) and not for the clicked one on + to expand.
I need to get the handle for node wich i clicked + and no the selected
one.
Is there a way to do what I need?
Many Thanks

Marcolino,
I tried to understand your issue and i hope adding these 2 events will
do what you want:

' Select node that's expanded
Private Sub TreeView1_AfterExpand(ByVal sender As System.Object, ByVal
e As System.Windows.Forms.TreeViewEventArgs) Handles
TreeView1.AfterExpand
TreeView1.SelectedNode = e.Node
End Sub

' Select node that's collapsed
Private Sub TreeView1_AfterCollapse(ByVal sender As System.Object,
ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles
TreeView1.AfterCollapse
TreeView1.SelectedNode = e.Node
End Sub

and TreeView1 is your TreeView control of course.

Hope this helps,

Onur Güzel- Nascondi testo tra virgolette -

- Mostra testo tra virgolette -
Hi All.
I solved. Thanks for your suggestions.

--Marco
Jun 27 '08 #4
On May 15, 2:18 am, Marcolino <marco.pozzu...@gmail.comwrote:
On 14 Mag, 23:54, kimiraikkonen <kimiraikkone...@gmail.comwrote:
On May 15, 12:17 am, Marcolino <marco.pozzu...@gmail.comwrote:
Hi I have a little problem with Treeview expand.
So I'll try to explain.
I Have one node and some subnodes like this
+Nodes1
|------Subnodes 1
|------Subnodes 2
+Nodes2
|------Subnodes 3
|------Subnodes 3
and so on....
Well if Nodes2 is selected, and I'll click on + Nodes1,in the
AfterExpand and AfterCollapse event I'll got handle for Nodes2 (the
selected one) and not for the clicked one on + to expand.
I need to get the handle for node wich i clicked + and no the selected
one.
Is there a way to do what I need?
Many Thanks
Marcolino,
I tried to understand your issue and i hope adding these 2 events will
do what you want:
' Select node that's expanded
Private Sub TreeView1_AfterExpand(ByVal sender As System.Object, ByVal
e As System.Windows.Forms.TreeViewEventArgs) Handles
TreeView1.AfterExpand
TreeView1.SelectedNode = e.Node
End Sub
' Select node that's collapsed
Private Sub TreeView1_AfterCollapse(ByVal sender As System.Object,
ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles
TreeView1.AfterCollapse
TreeView1.SelectedNode = e.Node
End Sub
and TreeView1 is your TreeView control of course.
Hope this helps,
Onur Güzel- Nascondi testo tra virgolette -
- Mostra testo tra virgolette -

Hi All.
I solved. Thanks for your suggestions.

--Marco
Glad it worked!

Thanks,

Onur
Jun 27 '08 #5

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

Similar topics

1
4231
by: Jürgen Müllder | last post by:
Hi! I have a TreeView in my Application. I have the MouseDown Attached to the TreeView. When i click at a Node it makes that what it should. But when i Expand a Node by clicking at the Plus Sign...
1
1630
by: Rick Delorme | last post by:
Hi, I have a MS treeview webcontrol in my page, it is wrapped with a div tag so that I can provide scrolling (the treeview has the potential to get quite long). However, when the scrolling is...
0
1413
by: Rod Billett | last post by:
I programmatically place a treeview inside a DIV tag to enable scrolling. I am also dynamically populating the nodes in the ExpandNode event. Before placing the treeview within the Div,...
2
1341
by: clsmith66 | last post by:
In a treeview, I am trying to store the index of every treenode as it expands in a hidden input box. If I click on the node itself, it expands and I can capture the node index no problem. If I...
4
10119
by: Karim El Jed | last post by:
Hi, I'm trying to expand a special Node of my TreeView from Codebehind. I have a TreeView on a page for navigating to another site. On the other tsite here is the same TreeView more precisely a...
0
2541
by: Shadow Lynx | last post by:
When using ASP.NET 2.0's built-in TreeView on a page with <BASE target = "AnythingBut_Self"></BASE> in the HEAD, the expand/collapse buttons fail to function. The reason for this is that the...
3
2235
by: Shawn | last post by:
Hi. I'm working with the TreeView control in my ASP.NET 1.1 application. I have a problem I haven't been able to figure out. When I click on a node (not expand), whether it's a parent node, a...
0
2405
by: jim | last post by:
Hi, I have a TreeView control that sits on the MasterPage. All of my other webpages inherit from that Master Page. The Treeview receives it's data using an XMLDataSource that has it's DataFile...
1
4896
by: doemon | last post by:
Hi, I'm working on a pagination control and I need to dynamically rerender a treeview to display the next set of nodes depending on which page we're on. For example, page 1 will dispaly only...
0
7106
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6967
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
6846
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7349
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5442
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4874
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
4565
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3076
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3071
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.