**<components>
<part>
<manufacturer>asus</manufacturer>
<model>A3-B</model>
</part>
<part>
<manufacturer>intel</manufacturer>
<model>V5-F</model>
</part>
</components>**
这是我为其创建树视图的xml。我通过treeview.selectednode.datapath访问该值。问题是,即使我点击第二部分,每次只显示第一部分的细节。我该如何解决这个问题?
编辑: 这是c代码:
protected void btnSelectFile_Click(object sender, EventArgs e)
{
LoadXMLTree("~/first.xml");
}
private void LoadXMLTree(string fileName)
{
try
{
xmlDataSource.DataFile = fileName;
xmlDataSource.EnableCaching = false;
xmlTreeView.DataSourceID = "xmlDataSource";
xmlTreeView.DataBind();
}
catch (Exception ex)
{
lblMessage.Text = "Exception: " + ex.Message;
}
}
protected void xmlTreeView_SelectedNodeChanged(object sender, EventArgs e)
{
XmlDocument doc = new XmlDocument();
doc.Load("~/first.xml");
XmlNode node =
doc.SelectSingleNode(xmlTreeView.SelectedNode.DataPath);
txtEditXML.Text = node.InnerXml;
Session["CurrentEditXpath"] = xmlTreeView.SelectedNode.DataPath;
}