Solved

TreeView JavaScript

Posted on 2006-07-16
5
323 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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

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…
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…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

832 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