473,549 Members | 2,334 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

treeview, checked

92 New Member
I have used the treeview control in my C# web application. In that i have a few parent nodes and there child nodes. i have set the ShowCheckboxes properties as ALL.
So if the ckeck box of a parent node or child node is checked how can i get the value of that checked nodes?
In the foreach loop what code should i use?
Please help me.
May 1 '08 #1
5 1821
shweta123
692 Recognized Expert Contributor
Hi,

You can use checked property of Treeview node to check that if that node is checked or not?
e.g.
Expand|Select|Wrap|Line Numbers
  1.  foreach (TreeNode nd in TreeView1.Nodes) { 
  2.         foreach (TreeNode cnd in nd.ChildNodes) { 
  3.          //Check for all child nodes if it is checked
  4.             if ((cnd.Checked)) { 
  5.               .................
  6.             } 
  7.         } 
  8.         if ((nd.Checked)) { 
  9.            //check for parent node if it is checked
  10.             .................            
  11.         } 
  12.     } 
I have used the treeview control in my C# web application. In that i have a few parent nodes and there child nodes. i have set the ShowCheckboxes properties as ALL.
So if the ckeck box of a parent node or child node is checked how can i get the value of that checked nodes?
In the foreach loop what code should i use?
Please help me.
May 2 '08 #2
Limno
92 New Member
Thanks 4 replying me,

can u suggest me, another query,
i wnt to display d database values in 3 levels through treeview.

ie.
Parent Node
ChildNode
SubChildNode

Please help me the c#.net Code, SQL 2005, Urgent!!!!!!!!

Thanks in Advance.






Hi,

You can use checked property of Treeview node to check that if that node is checked or not?
e.g.
Expand|Select|Wrap|Line Numbers
  1.  foreach (TreeNode nd in TreeView1.Nodes) { 
  2.         foreach (TreeNode cnd in nd.ChildNodes) { 
  3.          //Check for all child nodes if it is checked
  4.             if ((cnd.Checked)) { 
  5.               .................
  6.             } 
  7.         } 
  8.         if ((nd.Checked)) { 
  9.            //check for parent node if it is checked
  10.             .................            
  11.         } 
  12.     } 
May 2 '08 #3
shweta123
692 Recognized Expert Contributor
Hi,

1) You can write the stored procedure for getting the Parent node and all the child nodes related to that parent node and for storing that data in some table using SQL SERVER 2005.

2) Call above stored procedure from .Net code. Select the data stored in the table and display it in the Treeview.
May 5 '08 #4
Limno
92 New Member
Thanks 4 replying me,

Another query plz.

I have a treeview control with showcheckboxes = All in my C#.net web application.

When i check on the child node its parent node should be checked automatically.s imilarlly when i uncheck a parent node all its childnodes should be unckecked.

When i check on the parent node all its child nodes should be checked automatically.


How can i do this?

is any possible way to do this........
May 6 '08 #5
shweta123
692 Recognized Expert Contributor
Hi,

You can refer this Link
May 8 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

3
821
by: feel | last post by:
Goin' crazy with this recursive function ported from delphi... I send a string like DirA/ DirB /DirC but i get in the treeView each one in a new node.Cant get the child node....!! -DirA -DirB -DirC instead of: DirA | - DirB
1
9461
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...
2
2402
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...
1
2166
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)
1
3248
by: nicholas | last post by:
I am using Obout TreeView: www.obout.com I would like to implement a page to add and remove categories to a product with the Obout Treeview with checkboxes. Does anyone allready did this and could help me with this?? Here is what I would like to do: -------------------------------- When the user selects a product, he can edit the...
2
22007
by: Jack | last post by:
Hello, I am trying use a TreeView with checkboxes. I would like to check more than one node and allow all child nodes of selected nodes to be checked or unchecked with the parent is checked. Thanks in advance for any help, Jack
3
3456
by: pamelafluente | last post by:
Hi I have some instances of a class: Class Myobject Public Color As Color Public Label As String End Class I need to show these instances on a treeview (which has checked boxes)
1
3263
by: Christian Rühl | last post by:
hey! what i wanna do sounds very simple at first, but it turned out to be a real bone crusher... i want to check if a treeView node is checked and if a correspondent node in my xml config file exists just to sort of synchronize them by changing the xml nodes attribute(s). somehow i always catch an exception "blabla has an invalid token"...
1
2579
by: Christian Rühl | last post by:
hey! what i wanna do sounds very simple at first, but it turned out to be a real bone crusher... i want to check if a treeView node is checked and if a correspondent node in my xml config file exists just to sort of synchronize them by changing the xml nodes attribute(s). somehow i always catch an exception "blabla has an invalid token"...
0
3287
by: divya1949 | last post by:
Create a windows c# application which will Read a xml file and populate nodes in the treeview. 1 On selection of treenode display the child nodes of that node in listview control 2. Provide following view properties to listview, through View menu a. Tile b. Icon
0
7546
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...
0
7740
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. ...
0
7985
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...
1
7503
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...
0
6071
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...
1
5387
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5111
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...
1
1962
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
0
784
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...

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.