J
Jan Limpens
Hello,
I am populating a tree with a XmlDataSource, and although I am
explicitly databinding it to the source upon every change in the xml's
structure, it will show the changes only after I rebuild the website.
The XmlDatasource receives the updated xml (shows in Debugger).
some code:
<asp:XmlDataSource ID="XmlDataSourceDocuments" runat="server"
XPath="/site/*"></asp:XmlDataSource>
<asp:TreeView ID="TreeViewDocuments" runat="server"
DataSourceID="XmlDataSourceDocuments"
OnSelectedNodeChanged="TreeViewDocuments_SelectedNodeChanged"
ImageSet="Arrows">
<DataBindings>
<asp:TreeNodeBinding DataMember="site:document"
ValueField="path" TextField="name" PopulateOnDemand="True" />
</DataBindings>
</asp:TreeView>
private void fillTree()
{
XmlHelper h = new XmlHelper();
XmlDataSourceDocuments.Data =
h.CreateXmlString(PhysicalStructure.Xml); // Data is up to date!
XmlDataSourceDocuments.DataBind(); // does not show up to date data!
}
protected void ButtonSaveChanges_Click(object sender, EventArgs e)
{
loadDocument(path);
if (document == null) {
createDocument(path);
} else {
///...
}
}
private void createDocument(string path)
{
XmlDocument prototype = new XmlDocument();
prototype.InnerXml = string.Format(@"<?xml version='1.0' ?><Entry
pubdate='{0}' id='{1}'/>", makeDateString(), fi.Name.Replace(".xml",
string.Empty));
prototype.Save(path);
fillTree();
loadDocument(path);
}
I tried implicitly clearing the tree before populating, disabled
PopulateFromClient but to no avail. The only thing that helps is rebuilding.
Thanks for any help!
Jan
I am populating a tree with a XmlDataSource, and although I am
explicitly databinding it to the source upon every change in the xml's
structure, it will show the changes only after I rebuild the website.
The XmlDatasource receives the updated xml (shows in Debugger).
some code:
<asp:XmlDataSource ID="XmlDataSourceDocuments" runat="server"
XPath="/site/*"></asp:XmlDataSource>
<asp:TreeView ID="TreeViewDocuments" runat="server"
DataSourceID="XmlDataSourceDocuments"
OnSelectedNodeChanged="TreeViewDocuments_SelectedNodeChanged"
ImageSet="Arrows">
<DataBindings>
<asp:TreeNodeBinding DataMember="site:document"
ValueField="path" TextField="name" PopulateOnDemand="True" />
</DataBindings>
</asp:TreeView>
private void fillTree()
{
XmlHelper h = new XmlHelper();
XmlDataSourceDocuments.Data =
h.CreateXmlString(PhysicalStructure.Xml); // Data is up to date!
XmlDataSourceDocuments.DataBind(); // does not show up to date data!
}
protected void ButtonSaveChanges_Click(object sender, EventArgs e)
{
loadDocument(path);
if (document == null) {
createDocument(path);
} else {
///...
}
}
private void createDocument(string path)
{
XmlDocument prototype = new XmlDocument();
prototype.InnerXml = string.Format(@"<?xml version='1.0' ?><Entry
pubdate='{0}' id='{1}'/>", makeDateString(), fi.Name.Replace(".xml",
string.Empty));
prototype.Save(path);
fillTree();
loadDocument(path);
}
I tried implicitly clearing the tree before populating, disabled
PopulateFromClient but to no avail. The only thing that helps is rebuilding.
Thanks for any help!
Jan