473,804 Members | 2,989 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

IE Treeview - Checking & Unchecking All Subnodes

Hello...

I've created a treeview that looks something like:

Root
.....Folder1
.........Subfol der1A
.............Fi le
.............Fi le
.........Subfol der1B
.............Fi le
.....Folder2
.........Subfol der2A
.............Fi le
.........Subfol der2B
.............Fi le
.............Fi le

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 2224
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.U I.WebControls.T reeViewClickEve ntArgs e){

TreeNode selectedNode =
TreeView1.GetNo deFromIndex(e.N ode);

if (selectedNode.N odes.Count>0){
foreach (TreeNode ChildNode in selectedNode.No des)
{ChildNode.Chec ked=selectedNod e.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
343
by: Pat Roy | last post by:
Hello... I've created a treeview that looks something like: Root .....Folder1 .........Subfolder1A .............File .............File .........Subfolder1B
2
2054
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 question <%@ Import Namespace="Microsoft.Web.UI.WebControls" %> <%@ Register TagPrefix="IE" Namespace="Microsoft.Web.UI.WebControls" Assembly="Microsoft.Web.UI.WebControls" %>
5
1826
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 add the subnodes from the Child column? Here's what I have so far. Thanks in advance. Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load If Not IsPostBack Then Dim MyConnection As...
4
2315
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 by the user either scrolling or performing some other action that would move the treeview window to a particular "unloaded" node in the treeview Any advice on how to go about this? It seems I need a way of sensing a scroll event in the treeview...
6
4373
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 Control.Invoke or Control.BeginInvoke to perform this action. I have multiple background-threads that returns info about their progress through a Event. This event's handler is then on a Form that has the responsability to display all the info...
2
5979
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
3241
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 subnodes don't matter in the first place.) After that, when i scroll totally to the bottom, the last item (the 9) rest almost totally invisable. This problem disappears, when i open (and close) one of the nodes. (The sample code uses subnodes only to...
3
5608
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, just so that I can get the "+" and the capability to expand. So the first time I click on any level-1 node, it loads 30 child nodes. The problem is how slow this is. To me it should be almost
4
7452
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
9909
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 will first find 'sonday' and the next time 'son'. ones it have found everything with the look parameter it restart at the top. Jan
0
9704
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9572
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10562
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10070
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9132
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6845
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5639
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4282
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2978
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.