[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Treeview node ID

Posted on 2008-10-06
4
Medium Priority
?
627 Views
Last Modified: 2013-12-17
I have a treeview with two levels.  The user clicks a check box that selects the name in the last node.  I move the text from this node into a text box.  Well, I also want to capture the id and put it into an array.  How do I do this?
foreach (DataRow dr in tissueLevel.Rows)
                    {
                        if (!treeView1.Nodes.ContainsKey(dr["tg_id"].ToString()))
                        {
                            treeView1.Nodes.Add(dr["tg_id"].ToString(), dr["name"].ToString());
                        }
                    }
                    foreach (DataRow dr in tissueLevel.Rows)
                    {
                        TreeNode[] nodes = treeView1.Nodes.Find(dr["tg_id"].ToString(), true);
                        if (nodes.Length > 0)
                        {
                            TreeNode node = nodes[0];
                            if (!node.Nodes.ContainsKey(dr["auto_id"].ToString()))
                            {
                                node.Nodes.Add(dr["auto_id"].ToString(), dr["label"].ToString());
                            }
                        }

Open in new window

0
Comment
Question by:MichelleLacy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 18

Accepted Solution

by:
Priest04 earned 2000 total points
ID: 22652309
Yo could save ID into TextBox Tag property.

Goran
0
 

Author Closing Comment

by:MichelleLacy
ID: 31503493
that is very logical and so obvious that I did not see it.  It helps to have another set of eyes.  Thanks so much!!!
0
 
LVL 18

Expert Comment

by:Priest04
ID: 22652875
You are welcome.

Goran
0
 

Author Comment

by:MichelleLacy
ID: 22653830
I figured out how to do it.  I tricky part was the diffference between the node text and the node name.  The text is what is displayed in the textbox, but the node name is the id that was after.  So to add to a list, it is simply  myList.Add(n2.Name.ToString())
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question