Rank: Advanced Member Groups: Member
Joined: 5/22/2009 Posts: 33
|
Hello Sir,
The following is my code to insert a node but it can not insert after a sub node, please help to let me know the correct way. Thank you.
// Insert a new node to TreeView EO.Web.TreeNode currentNode = areaCodeTreeView.SelectedNode; index = currentNode.Index; //index = areaCodeTreeView.Nodes.IndexOf(currentNode);
EO.Web.TreeNode newNode = new EO.Web.TreeNode("New added code"); newNode.AllowEdit = EO.Web.NullableBool.True;
this.areaCodeTreeView.Nodes.Insert(index, newNode);
My problem is that if I want to insert a node under "100", using the code above, it will insert a node between "100" and "200". How can I insert a node under "100"? Thank you for your help.
Root +--- 100 +--- 200
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
You can use something like this:
areaCodeTreeView.Nodes[0].ChildNodes.Add(newNode);
Please take a look of the API reference section for all available properties/methods.
Thanks
|