Chris Johnson

Chris Johnson

  • NA
  • 67
  • 32.2k

Get Treeview Node Value on click

Sep 22 2011 10:51 AM
Hello all,

I am trying to get the clicked nodes value and enter that value into a label.
I am sure I am on the right lines using the After_Select event, somthing like this.

private void treeView2_AfterSelect(object sender, EventArgs e)
  {
  Label2.Text = TreeView2.SelectedNode.Value;
  }


Unfortunately this returns nothing. So basically say the rootnode of a treeview (Bound to sql server but this makes no difference)  was "RT00000215", when the node is clicked to expand it I need the root node string to appear in a label.


Could anyone please help me?

Answers (5)