TreeView control - synchronizing changes to data source


M

magnus.lassi

Hi,

I have a problem with the treeview control. My scenario is the
following:

I have an asp.net 2.0 (C#) web application with different tabs defined
in a sitemap. I have an admin page that admin users will be able to
modify in what order the tabs will be displayed and also add new tabs.

Currently I'm using a TreeView control and an XmlDataSource that points
to the web.sitemap . My problem is that after I add nodes and/or move
around nodes in the treeview, I haven't found a way of updating the
changes to the XmlDataSource so I can write all the changes either back
to the web.sitemap or another file. If I get the XMlDocument from the
XmlDataSource, it doesn't have my modified/added nodes, only how the
web.sitemap looked like when I first went to the page.

I have only been able to get it to work if I get the XmlDoucument and
from the XmlDataSource and makes changes to it like this:

XmlDocument doc = XmlDataSource1.GetXmlDocument();
XmlNode node =
doc.SelectSingleNode(SiteMapEditCtl.SelectedNode.DataPath);

node.InnerText = "new changes";

XmlDataSource1.Save();

It would be pretty messy to have to iterate through all the tree nodes
in the TreeView and update the XmlDataSource when I want to save all
changes.

Is there an easier way to be able to get the changes to synchronize
from the TreeControl to the XmlDataSource (or SiteMapDataSource)?

TIA,
Magnus
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top