473,386 Members | 1,795 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

IE Treeview - Checking & Unchecking All Subnodes

Hello...

I've created a treeview that looks something like:

Root
.....Folder1
.........Subfolder1A
.............File
.............File
.........Subfolder1B
.............File
.....Folder2
.........Subfolder2A
.............File
.........Subfolder2B
.............File
.............File

Each of the folders and files have the checkbox property turned on, so that everything but the root node has a checkbox. Now I need help with code the checks or uncheck all subfolders and files when a parent checkbox is checked or unchecked. Make sense?

So, for example, if the user checks Folder1's checkbox on, then all Folder1's subfolders and files need to have there checkboxes checked on.

I've been banging my head on this one and haven't figured anything out yet. Any help would be appreciated.

Nov 18 '05 #1
1 2204
Not sure if you want C# or vb.net but the code (c#) I'm using is:

private void TreeView1_Check(object sender, Microsoft.Web.UI.WebControls.TreeViewClickEventArg s e){

TreeNode selectedNode =
TreeView1.GetNodeFromIndex(e.Node);

if (selectedNode.Nodes.Count>0){
foreach (TreeNode ChildNode in selectedNode.Nodes)
{ChildNode.Checked=selectedNode.Checked;}
}

}

If you want the vb code let me know and I'll translate.

Nicki


---
Posted using Wimdows.net NntpNews Component -

Post Made from http://www.DotNetJunkies.com/newsgroups Our newsgroup engine supports Post Alerts, Ratings, and Searching.
Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Pat Roy | last post by:
Hello... I've created a treeview that looks something like: Root .....Folder1 .........Subfolder1A .............File .............File .........Subfolder1B
2
by: Irishmaninusa | last post by:
Hello, I am a newbie to asp.net and I am trying to do sample code using the treeview code, and for some reason it is not displaying the way I would expect it to display. HEre is the code in...
5
by: Hutty | last post by:
I have a table that has two columns, Parent and Child. I'm able to populate a IEControls treeview with the Parent column. On the same row as the Parent is the child in the Child colum. How do...
4
by: pmcguire | last post by:
I have a treeview with a lot of nodes. I want to load only the nodes that are initially visible when the form loads, and then continue to populate it in background and/or when the nodes are required...
6
by: Jarod_24 | last post by:
This is the exception i'm getting: System.InvalidOperationException: The action being performed on this control is being called from the wrong thread. You must marshal to the correct thread using...
2
by: (PeteCresswell) | last post by:
Are there TreeViews that can be sorted on-the-fly? i.e. that can be sorted without reloading them? -- PeteCresswell
6
by: Christof Nordiek | last post by:
Hi all, in my WinForm-Application i have a strange problem with the TreeView Control. As you can see in the samplecode below, i fill the TreeView by adding some nodes with sub nodes. (The...
3
by: cowznofsky | last post by:
Rather than load all my data into the treeview I am loading when a level-1node gets expanded (for the first time). To set up the code below, I've added a single child node for each level-1node,...
4
by: Marcolino | last post by:
Hi I have a little problem with Treeview expand. So I'll try to explain. I Have one node and some subnodes like this +Nodes1 |------Subnodes 1 |------Subnodes 2 +Nodes2
1
by: JR | last post by:
Hi, I need a routine/finction that finds a text, starting at the selected node, where a given text is in. say i have some nodes with 1 'sonday' and another with 'son' and I look for 'so' it...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.