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. Web Development
  3. ASP.NET
  4. TreeView - Load/Save XMLDataSource

TreeView - Load/Save XMLDataSource

Scheduled Pinned Locked Moved ASP.NET
xmlquestion
2 Posts 2 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.
  • K Offline
    K Offline
    krishy19
    wrote on last edited by
    #1

    Hi, I've successfully loaded an XML file into a TreeView by using the XmlDataSource, which appears to be quite convenient. I can then add and remove items on the TreeView but having called the XmlDataSource.Save() method, my changes are not persisted to the file so when I bind the TreeView back to the XmlDataSource, I lose my changes. 1. I click the "Load" button which initiates the TreeView contents from the XML file by simply calling DataBind() on the TreeView. 2. I then add/edit/delete nodes using suitable buttons and my changes are reflected in the TreeView - that works fine. 3. I click the "Save" button. I'd expect the XmlDataSource.Save() method to write my TreeView back to the bound data source. I've tried calling BindData() on the XmlDataSource itself but that does nothing. Any suggestions please? :)

    A 1 Reply Last reply
    0
    • K krishy19

      Hi, I've successfully loaded an XML file into a TreeView by using the XmlDataSource, which appears to be quite convenient. I can then add and remove items on the TreeView but having called the XmlDataSource.Save() method, my changes are not persisted to the file so when I bind the TreeView back to the XmlDataSource, I lose my changes. 1. I click the "Load" button which initiates the TreeView contents from the XML file by simply calling DataBind() on the TreeView. 2. I then add/edit/delete nodes using suitable buttons and my changes are reflected in the TreeView - that works fine. 3. I click the "Save" button. I'd expect the XmlDataSource.Save() method to write my TreeView back to the bound data source. I've tried calling BindData() on the XmlDataSource itself but that does nothing. Any suggestions please? :)

      A Offline
      A Offline
      Arindam Sinha
      wrote on last edited by
      #2

      bugmenot1234 wrote:

      I'd expect the XmlDataSource.Save() method to write my TreeView back to the bound data source.

      I would ask you to check that if you are getting any exception while performing Save. I was going through the MSDN [^]documentation of Save method, I found few points which you should consider as it can be used only for following scenarios - 1. The XML data is loaded from an XML file indicated by the DataFile property, not from inline XML data specified in the Data property. 2. No XSLT transformation is specified in the Transform or TransformFile properties. Also, keep in mind Save does not handle concurrent scenario.

      Regards, Arindam Sinha MyBlog - http://arindamsinha.wordpress.com/ Please give your feedback on this message using rating.

      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