473,663 Members | 2,705 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

expand treeview node when checkbox checked

Hi Experts
I have a windows form with a TreeView control with the CheckBoxes property
set to True.
When I check a node, I want that node and all it's child nodes to be checked
and expanded.
I've tried various things but none seem to work correctly.
Any ideas?

thanks
Jun 27 '08 #1
1 6871
I have a windows form with a TreeView control with the CheckBoxes property
set to True.
When I check a node, I want that node and all it's child nodes to be checked
and expanded.
I've tried various things but none seem to work correctly.
Any ideas?
I did a quick testing and following seemed to do what you wanted:
Create eventhandler for TreeView.AfterC heck -event.

You can get the checked node from TreeViewEventAr gs. Let's assume e.

if (!e.Node.Checke d)
{
foreach (TreeNode child in e.Node.Nodes)
{
child.Checked = false;
}
e.Node.Collapse (false);
}
else
{
foreach (TreeNode child in e.Node.Nodes)
{
child.Checked = true;
}
e.Node.ExpandAl l();
}
Jun 27 '08 #2

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

Similar topics

1
9462
by: kiran | last post by:
I cratee a form to meet the fallowing requirement. 1. If any node is selected the corresponding checkbox should be checked 2. If any checkbox is clicked the corresponding node should be selected 1st requirement is working ,but, 2nd requirement is not wokring properly. when I click a checkbox the coresponding node is being selected , but checkbox is not in checked mode. To get the check box in checked mode i have to click two times or...
2
2409
by: Srinivasa Raghavan | last post by:
Hi I am using ASP Tree View Control to display data in hiearchy fashion.I am having a checkbox next to the TreeView Node.When user checks or unchecks the nodes and click a button i am putting that count in a stringcollection which is in viewstate.The count is wrong after certain checks and click of the button.can any one explain what could be wrong.
1
2172
by: Srinivasa Raghavan | last post by:
Hi All, I have some doubts on the Treeview control and Form Authentication 1) will Form Authentication work if cookies are disabled. 2) I have problem in the following code (TreeView Control with checkbox)
2
2424
by: Stephen | last post by:
In asp.net 1.1, the IE treeview web control has a property called "SelectExpands" that, when set to true, expands a node when a user clicks the node text. I can't seem to replicate this in the treeview control in .net 2.0. Anyone know of way to expand a node when a users clicks the node text?
4
10133
by: Karim El Jed | last post by:
Hi, I'm trying to expand a special Node of my TreeView from Codebehind. I have a TreeView on a page for navigating to another site. On the other tsite here is the same TreeView more precisely a new TreeView with the same nodes ;) So I would like to keep the expanding state of the first Tree for the second one on the next page. At least the last selected node (path will be saved in query string) should be expanded.
2
4687
by: Alex D. | last post by:
Does anybody knows how to enable autopostbcak in a TreeView when a checkbox in a node is checked (or unchecked)?? Thanks, Alex.
2
3562
by: yxq | last post by:
Hello There are checkbox in my treeview, i want to know which node checked? in which event? How to know which level node? Thanks
0
1970
by: stevobenno | last post by:
I have spent two days unsuccessfully trying to add cascading checkbox functionality to the IE Treeview in 1.1. Has anyone managed to do this.? I did manage to get some javascript that by all accounts works nicely in 2.0 but just can't seem to work out how to modify it. I can get it so that when I call this function from the checkbox click event EVERY checkbox in the control gets checked and vice versa. Help!
2
4398
by: govolsbaby | last post by:
Hi All I've got a treeview with checkboxes. I want the user to be able to toggle the checkbox by click on the checkbox OR by clicking on the node text. So I've added an afterselect event handler to get the selected node and change the .Checked property of the selected node as appropriate, which works to change the .Checked status when the user FIRST clicks on the text of a particular node.
0
8857
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
8768
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8547
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8633
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
7368
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
5655
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
4181
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2763
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
2
1999
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.