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