Solved

TreeView JavaScript

Posted on 2006-07-16
5
324 Views
Last Modified: 2008-01-09
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
0
Comment
Question by:RamzyEbeid
  • 2
5 Comments
 

Author Comment

by:RamzyEbeid
ID: 17117741
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
0
 
LVL 12

Expert Comment

by:deanvanrooyen
ID: 17120017
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
0
 
LVL 12

Accepted Solution

by:
deanvanrooyen earned 500 total points
ID: 17120064
hi

check this ASP.NET 2.0 Treeview Checkboxes - Check All - Javascript - this is done withouth the postback like above
http://geekswithblogs.net/ranganh/archive/2006/03/25/73300.aspx
http://forums.asp.net/1243475/ShowThread.aspx#1243475

to do the post back you can modify the javascript in the above links and call the __doPostBack(eventTarget, eventArgument) from their code,

there is a bit of work here - I am just putting you on the right track, or just wade around google to find the solution to the post back
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question