This is a migrated thread and some comments may be shown as answers.

Client-side script does not work

1 Answer 52 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 03 Apr 2009, 02:21 PM

I am using the RadTree in the ASP.NET AJAX Toolkit and have run into a problem.  I cannot use the tri-state functionality for certain situations in my code and must use a custom JavaScript function to uncheck parent nodes when the child node is unselected.  I found this snippet in the knowledge base.  Unfortunately it does not work as promised. 

When I run this code it unchecks the parent node but also unchecks all of the current nodes siblings.  I put an alert function in the while loop and found that it returns a message that says “I am unchecking  undefined”.  What am I missing?  Thank you.

 

function clientNodeChecked(sender, eventArgs)

        {

           var node = eventArgs.get_node();  

           alert("I am unchecking " + node.Text);    

            if (!node.get_checked())

            {      

                while (node.get_parent().set_checked != null)

                {

                    node.get_parent().set_checked(false);

                    node = node.get_parent();

                    alert("I am unchecking " + node.Text);

                }

            }

        }

1 Answer, 1 is accepted

Sort by
0
Michael
Top achievements
Rank 1
answered on 04 Apr 2009, 04:07 AM
I found what I was missing.  It was a simple fix.  I had to set the property that updates child nodes to false.  I then added to the Javascript above to get the behavior I needed.
Tags
TreeView
Asked by
Michael
Top achievements
Rank 1
Answers by
Michael
Top achievements
Rank 1
Share this question
or