Only export, not export/import? This is really simple but requires one more input: XML schema and mapping between the
TreeView
data and this schema.
Everything is easy: traverse in a loop the root nodes using
System.Web.UI.WebControls.TreeView.Node
, for each node call some recursive function which writes the node properties in the XML (or DOM) and call the same function for child nodes.
See this code for example:
http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/8e6db1e6-e429-4b4f-9ac6-5e848604188b/[
^].
For XML you can use
System.Xml.XmlTextWriter
,
System.Xml.XmlDocument
(it implements DOM, is the simplest to use but only good for relatively small amount of data) or
System.Xml.Linq.XDocument
.
—SA