how can i add a new node in treeview programatically ? and save changes?
-
samidhas wrote:
how can i add a new node in treeview for an xml backend file? and save it?
I suggest you break your statement down to it's individual problems and solve each one separately until you understand each of them well enough to tackle the complete set of requirements.
led mike
-
I replied to your other thread, but you should be using the XMLDataSource and it's Save method to save the XML. I beleive you should just be able to add nodes by creating a new node entry.
// Create the new node.
TreeNode newNode = new TreeNode();
newNode.Text = row["CategoryName"].ToString();
newNode.Value = row["CategoryID"].ToString();// Set the PopulateOnDemand property to true so that the child nodes can be
// dynamically populated.
newNode.PopulateOnDemand = true;// Set additional properties for the node.
newNode.SelectAction = TreeNodeSelectAction.Expand;// Add the new node to the ChildNodes collection of the parent node.
node.ChildNodes.Add(newNode);