Jump to content

TreeView Problem


cyrus_

Recommended Posts

Hi,I have a UserControl that contains a TreeView(with nodes) , a TextBox and a Button, I want when you click on the button you add new node under the selected node that it's name is the text of the TextBox.it can be solved by following code:treeView1.SelectedNode.Nodes.Add(new TreeNode(textBox1.Text));but my problem is the applicatin runs on a server and it can be restarted and the nodes must be left there,I have tryed a lot but no success, I need som code, thanks

Link to comment
Share on other sites

You need to store the node structure in a database and load the TreeView form the database. Then when the Add Node button is clicked you add the node to the TreeView AND the database. That way whent he page is reloaded the new Nodes are not lost.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...