A strange JScript behavior

Discussion in 'ASP .Net Web Controls' started by Maris Janis Vasilevskis, Apr 24, 2006.

  1. Hi,

    Of course, I know, that the old WebControls are unsupported (I use treeview.htc copyrighted 2000-2003)
    However, it seems to be a JScript problem (I use IE 6.0 with all updates).
    The problem seems to be with some too early destroy when function called in return statement.

    My task is to find node index from node data at client side.
    My solution:

    function NodeIndexFromNodeData(parentNode,aNodeData) {
    var children=parentNode.getChildren();
    var i,n=children.length;
    var node, nodeData;
    var s;
    for(i=0;i<n;i++) {
    node=children;
    nodeData=node.getAttribute("NodeData");
    // s=node.getNodeIndex();
    if(nodeData==anodeData) return node.getNodeIndex();
    s=NodeIndexFromNodeData(node,aNodeData);
    MyDebugOutput('s='+s);
    if(s) return s;
    }
    return '';
    }

    As written, MyDebugOutput shows s=null after correct data found.
    If I uncomment the nonfunctional assignment before return, everything works.

    Any ideas?

    Mahris

    P.S. I have also a true TreeView problem. Maybe somebody has any experience with the unsupported version?
    I cannot retrieve text attribute from a node which never has been visible.

    I create my tree at server side (NET 1.1) with a command set like
    node=new TreeNode();
    node.Text=sometext;
    node.NodeData=anothertext;
    ParentNode.Nodes.Add(node);

    When I process the tree at client side, I can apply to a node commands
    node.getAttribute("NodeData");
    node.getNodeIndex();
    However, node.getAttribute("Text"); throws exception.

    My current workaround: set "expanded" to true for all nodes till desired, and only then
    node.getAttribute("Text");

    I wonder whether anybody knows some way to activate attributes without visual expanding.
    Maris Janis Vasilevskis, Apr 24, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jon Maz
    Replies:
    4
    Views:
    1,245
    Jon Maz
    Sep 9, 2004
  2. Maxwell2006
    Replies:
    5
    Views:
    2,371
    Steven Cheng[MSFT]
    Mar 7, 2006
  3. Mantorok Redgormor
    Replies:
    70
    Views:
    1,720
    Dan Pop
    Feb 17, 2004
  4. John Bentley
    Replies:
    14
    Views:
    331
    Jim Ley
    Feb 5, 2004
  5. VK
    Replies:
    4
    Views:
    344
    Thomas 'PointedEars' Lahn
    Jan 12, 2006
Loading...

Share This Page