Solved

TreeView JavaScript

Posted on 2006-07-16
5
315 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 Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

AJAX ModalPopupExtender has a required property "TargetControlID" which may seem to be very confusing to new users. It means the server control that will be extended by the ModalPopup, for instance, if when you click a button, a ModalPopup displays,…
Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

707 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now