• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2986
  • Last Modified:

Can you disable the Treeview double-click expanding of nodes?

I am trying to do some custom action with a treeview when a node is double-clicked.  The problem is that even when I don't have my own doubleclick event handler, the Treeview uses the double-click to automatically expand or contract an expandable node.  Is there a way to turn off this behavior?  It would be ideal if the nodes would only expand/contract if the +/- box on the node were clicked, and the double-click could be for the custom action.
0
srbentley
Asked:
srbentley
  • 3
  • 2
1 Solution
 
zeesh80Commented:
Hello,
You can easily disable the expansion of tree-view on user double-click by ;
Go in to the treeview node editor and then in the properties set the 'SelectAction' property to 'Select' or 'None' so as to disable the doubl-click behaviour.
0
 
srbentleyAuthor Commented:
I'm adding the nodes dynamically and I was going to use the SelectAction as mentioned, but that property is not available??? I tried to do a MyNode.SelectAction but does not find it in Visual Studio 2008.
                MyNode = New TreeNode
                MyNode.Name = "S" & CStr(dr.Item(0))
                MyNode.Text = dr.Item(2)
                MyNode.Tag = "SECTION-" & dr.Item(2)
                RootNode.Nodes.Add(MyNode)
                MyNode = Nothing

Open in new window

0
 
zeesh80Commented:
Try adding a node in the design view by clicking the Smart tag for the treeview control , add a node and  see if its 'SelectAction' property is available.
0
 
srbentleyAuthor Commented:
I see now why it is not available... this TreeView is inside a usercontrol and so my Nodes are System.Windows.Form.TreeNode not System.Web.UI.WebControls.TreeNode.  The SelectAction is not in the windows.form version.  My control had Imports System.Web.  I tried imporing System.Web.UI.WebControls, then it broke the code I showed earlier.  Can you even put a WebControl version of the treeview into a UserControl?  I don't see it on the Toolbar or does it have to be done programatically?
0
 
srbentleyAuthor Commented:
Your tip of using SelectAction didn't fix my problem, but it did put me on the right path to finding the solution.  I have moved this question to the vb.net section since I'm doing a Usercontrol inside of asp.net, and thus it really is a vb.net issue.
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now