473,403 Members | 2,270 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,403 software developers and data experts.

treeview, checked

92
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 1807
shweta123
692 Expert 512MB
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
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 Expert 512MB
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
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.similarlly 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 Expert 512MB
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
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...
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...
1
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...
2
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. ...
3
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
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...
1
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...
0
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. ...
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: 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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
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
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...
0
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...

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.