How to extend .NET TreeView node by clicking its text instead of +/-

I use hard-coded hyperlinks to navigate web applications, but the application has grown since then, and managing it becomes a real pain. I decided to replace what I have with the TreeView control, however I want to make a few changes in how it looks.

Is there any property that needs to be set so that the user can expand the TreeView node by clicking its text instead of +/-? I have already set ShowExpandColapse to false.

I want my end result to be something similar to the TreeView to the left of the MSDN site.

Can someone point me in the right direction?

+3
source share
4 answers

TreeNode.SelectAction, SelectExpand.

+6

xml db treview

TreeView DataBound d, , node .

 protected void TreeView1_DataBound(object sender, EventArgs e)
{

    foreach (TreeNode node in TreeView1.Nodes)
    {
        node.SelectAction = TreeNodeSelectAction.Expand;
        PrintNodesRecursive(node);
    }
}


    public void PrintNodesRecursive(TreeNode oParentNode)
    {


      // Start recursion on all subnodes.
     foreach(TreeNode oSubNode in oParentNode.ChildNodes)
  {
    oSubNode.SelectAction = TreeNodeSelectAction.Expand;
  PrintNodesRecursive(oSubNode);
  }
 }
+2

, : Click, node Expanded ( , ).

0

Source: https://habr.com/ru/post/1785002/


All Articles