Link to home
Start Free TrialLog in
Avatar of RamzyEbeid
RamzyEbeid

asked on

TreeView JavaScript

Dear Experts
i am using ASP.NET 2.0, C#, VS2005

i want to to check all child nodes of any parent,
and if i checked a child i want it parent to be autochecked

can you tell me how to do that
thank you
Avatar of RamzyEbeid
RamzyEbeid

ASKER

sorry other thing
i am asking also how to post back the page when i check or uncheck the checkbox in the tree view control

thank you
this is how to check all the children

    protected void TreeView1_SelectedNodeChanged(object sender, EventArgs e)
    {
        TreeView tv = (TreeView)sender;
        TreeNode tn = tv.SelectedNode;
        CheckAllChildNodes(tn);
    }

    public void CheckAllChildNodes(TreeNode child)
    {
        foreach (TreeNode n in child.ChildNodes)
        {
            n.Checked = true;
            CheckAllChildNodes(n);
        }
    }

I am not sure how to post pack the page on check/uncheck) box
ASKER CERTIFIED SOLUTION
Avatar of deanvanrooyen
deanvanrooyen

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial