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

Home Posts Topics Members FAQ

add a child node , tree view

I am putting data from DataTable to treeView

foreach( DataRow aRow in aTable.Rows)
{
TreeNode tnode = new TreeNode(aRow[1].ToString() + aRow[2].ToString() +
" " + aRow[3].ToString());
treeView1.Nodes .Add(tnode);
//till here code works fine
//now I wanna add child nodes for last inserted node
foreach( DataRow GrupaRow in TabelaGrupe.Row s)
{
if(statment)
{
TreeNode tnodegr = new TreeNode(GrupaR ow[2].ToString()
+ " " + GrupaRow[3].ToString());
//what should I write here to put node tnodegr as a child to last
inserted tnode
treeView1.Nodes .Add(tnodegr);//????
}
}
treeView1.Expan dAll();
}
Nov 16 '05 #1
12 20509
foreach( DataRow aRow in aTable.Rows)
{
TreeNode tnode = new TreeNode(aRow[1].ToString() + aRow[2].ToString() +
" " + aRow[3].ToString());
//till here code works fine
//now I wanna add child nodes for last inserted node
foreach( DataRow GrupaRow in TabelaGrupe.Row s)
{
if(statment)
{
TreeNode tnodegr = new TreeNode(GrupaR ow[2].ToString()
+ " " + GrupaRow[3].ToString());
tnode.Nodes.Add (tnodegr);
treeView1.Nodes .Add(tnode);
}
}
treeView1.Expan dAll();
}
"Dino L." <se******@gmail .com> wrote in message
news:Ob******** ******@TK2MSFTN GP12.phx.gbl...
I am putting data from DataTable to treeView

foreach( DataRow aRow in aTable.Rows)
{
TreeNode tnode = new TreeNode(aRow[1].ToString() + aRow[2].ToString() +
" " + aRow[3].ToString());
treeView1.Nodes .Add(tnode);
//till here code works fine
//now I wanna add child nodes for last inserted node
foreach( DataRow GrupaRow in TabelaGrupe.Row s)
{
if(statment)
{
TreeNode tnodegr = new TreeNode(GrupaR ow[2].ToString()
+ " " + GrupaRow[3].ToString());
//what should I write here to put node tnodegr as a child to last
inserted tnode
treeView1.Nodes .Add(tnodegr);//????
}
}
treeView1.Expan dAll();
}

Nov 16 '05 #2
foreach( DataRow aRow in aTable.Rows)
{
TreeNode tnode = new TreeNode(aRow[1].ToString() + aRow[2].ToString() +
" " + aRow[3].ToString());
//till here code works fine
//now I wanna add child nodes for last inserted node
foreach( DataRow GrupaRow in TabelaGrupe.Row s)
{
if(statment)
{
TreeNode tnodegr = new TreeNode(GrupaR ow[2].ToString()
+ " " + GrupaRow[3].ToString());
tnode.Nodes.Add (tnodegr);
treeView1.Nodes .Add(tnode);
}
}
treeView1.Expan dAll();
}
"Dino L." <se******@gmail .com> wrote in message
news:Ob******** ******@TK2MSFTN GP12.phx.gbl...
I am putting data from DataTable to treeView

foreach( DataRow aRow in aTable.Rows)
{
TreeNode tnode = new TreeNode(aRow[1].ToString() + aRow[2].ToString() +
" " + aRow[3].ToString());
treeView1.Nodes .Add(tnode);
//till here code works fine
//now I wanna add child nodes for last inserted node
foreach( DataRow GrupaRow in TabelaGrupe.Row s)
{
if(statment)
{
TreeNode tnodegr = new TreeNode(GrupaR ow[2].ToString()
+ " " + GrupaRow[3].ToString());
//what should I write here to put node tnodegr as a child to last
inserted tnode
treeView1.Nodes .Add(tnodegr);//????
}
}
treeView1.Expan dAll();
}

Nov 16 '05 #3
A small change

foreach( DataRow aRow in aTable.Rows)
{
TreeNode tnode = new TreeNode(aRow[1].ToString() + aRow[2].ToString() +
" " + aRow[3].ToString());
//till here code works fine
//now I wanna add child nodes for last inserted node
foreach( DataRow GrupaRow in TabelaGrupe.Row s)
{
if(statment)
{
TreeNode tnodegr = new TreeNode(GrupaR ow[2].ToString()
+ " " + GrupaRow[3].ToString());
tnode.Nodes.Add (tnodegr);
}
}
treeView1.Nodes .Add(tnode);
}
treeView1.Expan dAll();

"Chester Ragel" <CR****@Virtusa .com> wrote in message
news:eo******** ******@TK2MSFTN GP14.phx.gbl...
foreach( DataRow aRow in aTable.Rows)
{
TreeNode tnode = new TreeNode(aRow[1].ToString() + aRow[2].ToString() +
" " + aRow[3].ToString());
//till here code works fine
//now I wanna add child nodes for last inserted node
foreach( DataRow GrupaRow in TabelaGrupe.Row s)
{
if(statment)
{
TreeNode tnodegr = new TreeNode(GrupaR ow[2].ToString()
+ " " + GrupaRow[3].ToString());
tnode.Nodes.Add (tnodegr);
treeView1.Nodes .Add(tnode);
}
}
treeView1.Expan dAll();
}
"Dino L." <se******@gmail .com> wrote in message
news:Ob******** ******@TK2MSFTN GP12.phx.gbl...
I am putting data from DataTable to treeView

foreach( DataRow aRow in aTable.Rows)
{
TreeNode tnode = new TreeNode(aRow[1].ToString() + aRow[2].ToString() +
" " + aRow[3].ToString());
treeView1.Nodes .Add(tnode);
//till here code works fine
//now I wanna add child nodes for last inserted node
foreach( DataRow GrupaRow in TabelaGrupe.Row s)
{
if(statment)
{
TreeNode tnodegr = new TreeNode(GrupaR ow[2].ToString()
+ " " + GrupaRow[3].ToString());
//what should I write here to put node tnodegr as a child to last
inserted tnode
treeView1.Nodes .Add(tnodegr);//????
}
}
treeView1.Expan dAll();
}


Nov 16 '05 #4
A small change

foreach( DataRow aRow in aTable.Rows)
{
TreeNode tnode = new TreeNode(aRow[1].ToString() + aRow[2].ToString() +
" " + aRow[3].ToString());
//till here code works fine
//now I wanna add child nodes for last inserted node
foreach( DataRow GrupaRow in TabelaGrupe.Row s)
{
if(statment)
{
TreeNode tnodegr = new TreeNode(GrupaR ow[2].ToString()
+ " " + GrupaRow[3].ToString());
tnode.Nodes.Add (tnodegr);
}
}
treeView1.Nodes .Add(tnode);
}
treeView1.Expan dAll();

"Chester Ragel" <CR****@Virtusa .com> wrote in message
news:eo******** ******@TK2MSFTN GP14.phx.gbl...
foreach( DataRow aRow in aTable.Rows)
{
TreeNode tnode = new TreeNode(aRow[1].ToString() + aRow[2].ToString() +
" " + aRow[3].ToString());
//till here code works fine
//now I wanna add child nodes for last inserted node
foreach( DataRow GrupaRow in TabelaGrupe.Row s)
{
if(statment)
{
TreeNode tnodegr = new TreeNode(GrupaR ow[2].ToString()
+ " " + GrupaRow[3].ToString());
tnode.Nodes.Add (tnodegr);
treeView1.Nodes .Add(tnode);
}
}
treeView1.Expan dAll();
}
"Dino L." <se******@gmail .com> wrote in message
news:Ob******** ******@TK2MSFTN GP12.phx.gbl...
I am putting data from DataTable to treeView

foreach( DataRow aRow in aTable.Rows)
{
TreeNode tnode = new TreeNode(aRow[1].ToString() + aRow[2].ToString() +
" " + aRow[3].ToString());
treeView1.Nodes .Add(tnode);
//till here code works fine
//now I wanna add child nodes for last inserted node
foreach( DataRow GrupaRow in TabelaGrupe.Row s)
{
if(statment)
{
TreeNode tnodegr = new TreeNode(GrupaR ow[2].ToString()
+ " " + GrupaRow[3].ToString());
//what should I write here to put node tnodegr as a child to last
inserted tnode
treeView1.Nodes .Add(tnodegr);//????
}
}
treeView1.Expan dAll();
}


Nov 16 '05 #5
thank you.

it works really good, just as I imagine
Nov 16 '05 #6
thank you.

it works really good, just as I imagine
Nov 16 '05 #7
can I add a search engine here?
how can I go from node to node and search ???
Nov 16 '05 #8
can I add a search engine here?
how can I go from node to node and search ???
Nov 16 '05 #9
You can use recursive search here easily like,

private void SearchNodes(Tre eNode node)
{
foreach(TreeNod e currentNode in node.Nodes)
{
//Do the search for the current node here
if((currentNode .Nodes!=null) && (currentNode.No des.Count>0))
{
SearchNodes(cur rentNode);
}
}
}

Call this methord from somewhere where you want to do the search and pass
the parent node there..

Chester.

"Dino L." <se******@gmail .com> wrote in message
news:u3******** ******@TK2MSFTN GP11.phx.gbl...
can I add a search engine here?
how can I go from node to node and search ???

Nov 16 '05 #10

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

Similar topics

0
1727
by: Saradhi | last post by:
Hi All, Here I am facing a performance problem with the TreeView Node renaming. I am displaying a hierarchy Data in a treeview in my Windows C# Application. My tree view represents an hierarchical view of Parent Nodes and projects where in a projectnode can be added to any ParentNode and hence we may have a project node added to 100 Parent...
0
360
by: Dino L. | last post by:
I am putting data from DataTable to treeView foreach( DataRow aRow in aTable.Rows) { TreeNode tnode = new TreeNode(aRow.ToString() + aRow.ToString() + " " + aRow.ToString()); treeView1.Nodes.Add(tnode); //till here code works fine //now I wanna add child nodes for last inserted node foreach( DataRow GrupaRow in TabelaGrupe.Rows)
3
6050
by: Saradhi | last post by:
Hi All, Here I am facing a performance problem with the TreeView Node renaming. I am displaying a hierarchy Data in a treeview in my Windows C# Application. My tree view represents an hierarchical view of Parent Nodes and projects where in a projectnode can be added to any ParentNode and hence we may have a project node added to 100 Parent...
7
3753
by: amruta | last post by:
the code below dows not let me get the parent child view... all the nodes are show in one line only... also i need them to be collasped ... Thanks ..
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
7
2277
by: Ward Germonpré | last post by:
Hi, On a html page I have a Table called "resultaattbl", generated using dom- methods and an array of jsobjects. The rows below the columnheader have a class called "normaal". This is the layout: ... <tr class=normaal> <td><td> <td><a href><img outlook-icon /></a>
2
4158
by: Bob | last post by:
Hi, I would to have a tree view control with check boxes in which the parent and child nodes interacts, in the way that you normally see this occuring. Checking the parent node automatically checks all its children node. Conversely, if one of the child nodes is unchecked, the parent node unchecks. Is there a property of the treeview that...
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
2
41330
by: Vajrala Narendra | last post by:
Hi, all am using asp.net 2.0, c# i have a tree view control from two tables i have to add nodes dynamically i hav category(cat_id,cat_name), sub category(sub_cat_id,cat_id,sub_cat_name) tables under category node i have to fill subcategory names as child node con.Open() cmd = New SqlCommand("select cat_id,cat_name from...
0
7548
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
7472
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...
0
7743
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. ...
1
7504
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
6074
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
5391
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
5114
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...
0
3499
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1965
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

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.