473,387 Members | 1,545 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,387 software developers and data experts.

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 6842
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.AfterCheck -event.

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

if (!e.Node.Checked)
{
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.ExpandAll();
}
Jun 27 '08 #2

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

Similar topics

1
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 ...
2
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...
1
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...
2
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...
4
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...
2
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
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
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...
2
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...
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: 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
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
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.