none
Getting the Key value from selected Treeview node RRS feed

  • Question

  • This seems like it should be really simple. 

    I have a tree view to which I have added several nodes.  I am adding the nodds as such: treeNode.Nodes.Add(strTaskid, strTaskName);

    What I wish to accomplish is the determine the key of the selected node.  So I thought I could use the AfterSelect Event of the treeview control

    private void treeViewMaster_AfterSelect(object sender, TreeViewEventArgs e)
            {
                string strNodeText = e.Node.Text;
            }

    For the life of me, I cannot determine the key of the selected node.

    Any suggestions?

    Wednesday, February 6, 2008 9:45 PM

Answers

  • It seems like as soon as I ask a question on this forum, I then find the answer.  The e.Node.Name is the key value.
    Wednesday, February 6, 2008 9:54 PM