Home - Forums-.NET - FlyTreeView (ASP.NET) - JavaScript Error while trying to run following code

FlyTreeView (ASP.NET)

Technical support and KB related to the FlyTreeView control

This forum related to following products: FlyTreeView for ASP.NET

JavaScript Error while trying to run following code
Link Posted: 08-Aug-2005 23:16
I am getting an error while trying to run the javascript code for client side events. "The object does not support this property or method."
    
    var ignoreEvents = false;
    function handleNodeEvent2(){
      if (ignoreEvents) return;
      ignoreEvents = true;
      var node = window.event.node;
      if (window.event.eventName == "ONLOADCHILDRENFINISHED") {
        setChildrenCheckBox(node, node.IsChecked);
      }
      else if (window.event.eventName == "ONCHECKED") {    
        setChildrenCheckBox(node, true);
        if (allSiblingChecked(node)) {
          setParentCheckBox(node, true);            
        }
      }
      else if (window.event.eventName == "ONUNCHECKED") {
        setChildrenCheckBox(node, false);
        setParentCheckBox(node, false);
      }
      ignoreEvents = false;
    }
    function allSiblingChecked(node){
      var nodes = node.ParentNode == null ? node.TreeView.Nodes : node.ParentNode.Nodes;
      var allChecked = true;
      for(var i = 0; i < nodes.length; i++) {
        if (!nodes[i].IsChecked){
          allChecked = false;
        }
      }
      return allChecked;
    }
    function setParentCheckBox(node, value){
      var parentNode = node.ParentNode;
      if (parentNode == null) return;
      if (parentNode.IsChecked != value)
        parentNode.CheckBoxChange();
      if (!value || allSiblingChecked(parentNode))
        setParentCheckBox(parentNode, value);
        
    }
    function setChildrenCheckBox(parentNode, value){
      for(var i = 0; i < parentNode.Nodes.length; i++) {
        var node = parentNode.Nodes[i];
        if (node.IsChecked != value)
          node.CheckBoxChange();          
        setChildrenCheckBox(node, value);
      }
    }
    

The error is on the line "node.CheckBoxChange();"
Link Posted: 12-Aug-2005 06:16
I suppose you get it at setChildrenCheckBox() method.
Probably this is because you're using load-on-demand or you're not forcing client-side initialization of treeview. You can do this by setting yourFlyTreeView.ForceInit = true;