Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

TreeView JavaScript

Posted on 2006-07-16
5
Medium Priority
?
337 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
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

722 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