How to save a TreeView ?

P

Polaris

Hi Experts:



I'm using ASP.NET 2.0. I'm using a TreeView control with a design-time
configured XmlDataSource (an XML file). I use the TreeView control as a
"message board" with each node representing a message. I noticed that the
TreeView loads alright from the XML file but did not save anything. I call
the TreeView.Save() for each new node added into the TreeView. What I'm
missing here?



Thanks in advance!

Polaris
 
P

PlatinumBay

Polaris,

I don't see a Save on either the TreeView or TreeNode controls. I do not
believe that the default TreeView has this functionality.

The XmlDataSource object does have a Save method, however. I would suggest
that when a TreeNode is added, removed or changed, that you capture those
events and update the XmlDataSource accordingly. You may wish to rebind the
control as well after making changes.

This article lists some code for the TreeView SelectedNodeChanged event:
http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.xmldatasource.save(VS.80).aspx

Hope this helps,


Steve
 

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

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top