Click here to Skip to main content
15,888,461 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Ive searched a lot looking for an answer for the problem but i havent found it

I want my asp TreeView to expand or collapse when clicking on the icon of each node, I ve seen a lot of expanding or collapsing when double clicking on the node, but i want it when clicking on the node image ONLY

The problem comes because we have a requirement which is not allowed to have the +/- buttons.
Posted

1 solution

Hi,

you can use the NodeMouseClick Event and simply check if node is expanded or not.

C#
if (e.Node.IsExpanded)
                e.Node.Collapse();
            else if (e.Node.Nodes.Count > 0)
                e.Node.Expand();



With best Regards
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900