Fix for Dynamic TreeView in ASPX

Last post 10-09-2004 8:33 PM by Rabbit11. 4 replies.

Sort Posts:

  • Fix for Dynamic TreeView in ASPX

    04-11-2003, 5:35 AM
    • Member
      20 point Member
    • R { Seb }
    • Member since 03-31-2003, 5:31 AM
    • Posts 4
    Hi,

    in order to use the TreeView webcontrol with the PostBack set to 'false' and still being able to load new children to parent nodes with the TreeNodeSrc attribute in the <tvns:treenode .../> tag, you have to modify the 'treenode.cs' file, which can be found under the 'src' directory in the IE Web Control folder.
    After altering this file, recompile using the 'build.bat'.

    All you have to add is:

    if (TreeNodeSrc != String.Empty)
    output.AddAttribute("TreeNodeSrc", TreeNodeSrc);

    in the function block of 'protected override void RenderUpLevelPath(HtmlTextWriter output)'!
    Best to add after 'if (Type != String.Empty)' block!

    Okay, that should solve my problem (see here: original question)

    Cheers,

    Seb!
  • Re: Fix for Dynamic TreeView in ASPX

    04-11-2003, 8:07 AM
    • Member
      30 point Member
    • fabiano_r
    • Member since 03-12-2003, 6:51 AM
    • Posts 6
    Works perfectly !!!!

    Thanks Seb !
  • Re: Fix for Dynamic TreeView in ASPX

    04-14-2003, 2:57 AM
    • Member
      20 point Member
    • R { Seb }
    • Member since 03-31-2003, 5:31 AM
    • Posts 4
    I still haven't figured out how to write a simple web service that returns an xml node list.
    I want something like on expand, load children from xml web service... I can stream xml to the browser in an aspx page using Response.Write but how to I return and stream XML to the browser using a Web Service?
  • Re: Fix for Dynamic TreeView in ASPX

    10-04-2004, 12:52 PM
    • Member
      20 point Member
    • alurch
    • Member since 10-04-2004, 12:47 PM
    • Indianapolis, IN
    • Posts 4
    I know this is an old post, but I was just doing some of these updates myself (thanks for the help by the way), and thought I'd mention something:

    If you're altering the TreeView control to perform such that an expand/collapse does not trigger postback, but selecting a node (clicking on the text) does, then you will need to change the code to this (as opposed to what R {Seb} posted): (Make sure to include the code in the RenderUpLevelPath method, and AFTER the check for "Expanded" (you need to reference the same object "b" from viewstate).


    if ( (TreeNodeSrc != String.Empty) && (!Expanded && !(b != null && (bool)b == false)) )
    output.AddAttribute("TreeNodeSrc",TreeNodeSrc);


    This will only include the TreeNodeSrc attribute if the element is not expanded, but does have a treenodesrc.

    Search the forum for a way to disable the postback on expand/collapse only.

    Hope this helps!
  • Re: Fix for Dynamic TreeView in ASPX

    10-09-2004, 5:25 PM
    • Member
      60 point Member
    • Rabbit11
    • Member since 08-01-2003, 5:39 AM
    • Posts 12
    Hi,

    If i understand this.....this fix will let me us nodParent.treeNodeSrc='myURL' on any node ? Currently i can use the TreeNodeSrc on the tree level, i.e the root but not to load individual child nodes children..please clarify. Thanks.

    Can i use this even in a client side script ? My treeview is on a HTM page implemented using the *.HTC file.


    Thanks in advance.
    Rohit
Page 1 of 1 (5 items)