Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

TreeView JavaScript

Posted on 2006-07-16
5
Medium Priority
?
347 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
3 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 2000 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

783 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