Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. how can i add a new node in treeview programatically ? and save changes?

how can i add a new node in treeview programatically ? and save changes?

Scheduled Pinned Locked Moved C#
questionxml
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    samidhas
    wrote on last edited by
    #1

    how can i add a new node in treeview for an xml backend file? and save it?

    L C 2 Replies Last reply
    0
    • S samidhas

      how can i add a new node in treeview for an xml backend file? and save it?

      L Offline
      L Offline
      led mike
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      • S samidhas

        how can i add a new node in treeview for an xml backend file? and save it?

        C Offline
        C Offline
        ChrisKo 0
        wrote on last edited by
        #3

        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);

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups