TreeView Expanding

Last post 02-18-2005 2:30 PM by jdixon. 2 replies.

Sort Posts:

  • TreeView Expanding

    02-16-2005, 7:30 PM
    • Member
      155 point Member
    • Eol
    • Member since 07-30-2004, 11:57 AM
    • Posts 31
    Hi All,

    I was wondering if anyone knew if it was possible to make a tree node expand by clicking on its text, as well as its + / - sign.

    I was figuring that it might be tricked into having the .NavigateURL set to "javascript:TreeView_ToggleNode(" + <properties i'm not sure about > + ")";
    However, I think that many of these are not created until render time, so it wouldn't be possible to do it while you add the nodes.

    Perhaps there is another property which I'm completely overlooking (which I hope).

    Thanks for any help you can give,
    Craig Gambino
  • Re: TreeView Expanding

    02-17-2005, 12:16 PM
    • Member
      155 point Member
    • Eol
    • Member since 07-30-2004, 11:57 AM
    • Posts 31
    I figured out one way to get this to work, although I'm not sure how susceptible it is to change:

    String TClientID = TreeViewControl.ClientID;
    int n = 0;

    If you increment N for each node you process, starting at the root node, then the following will work:

    Node.NavigateUrl =
    "javascript:TreeView_ToggleNode(" + TClientID + "_Data," + n.ToString() + "," + TClientID + "n" + n.ToString() + ",' '," + TClientID + "n" + n.ToString() + "Nodes)";

    I'm open to comments / suggestions on this code.

    -Craig
  • Re: TreeView Expanding

    02-18-2005, 2:30 PM
    • Contributor
      2,210 point Contributor
    • jdixon
    • Member since 06-24-2002, 4:41 AM
    • Redmond
    • Posts 438
    • AspNetTeam
    see this post:

    http://www.asp.net/Forums/ShowPost.aspx?tabindex=1&PostID=832340

    Basically you can set the selectAction property on the node.

    HTH

    JD
    This posting is provided "AS IS" with no warranties, and confers no rights.
    We Are Hiring
Page 1 of 1 (3 items)