XmlDataSource にバインドされたツリービューがあります。この XmlDataSource の本体でキーワードを検索し、ツリービューを再バインドしたいと考えています。それを説明するこの記事を見つけましたが、私の検索では何も返されません。
私のxmlは以下のようになります:
<?xml version="1.0" encoding="utf-8"?>
<articles name="articles">
<folder name="Folder1">
<article name="art1">
<body>This is body 1</body>
<createuser>someuser</createuser>
<createddate>28/02/2013 06:24:34</createddate>
</article>
<article name="art2">
<body><p> this is body 2</body>
<createuser>someuser2</createuser>
<createddate>28/02/2013 06:30:36</createddate>
</article>
</folder>
</articles>
私が使用したコードは、以下のようにボタンをクリックして、キーワードとして「this」と入力しています。
protected void btnSearch_Click(object sender, EventArgs e)
{
XmlArticle.XPath = "/articles/folder/article[body='" + txbSearch.Text + "']";
//XmlArticle.XPath = "/articles/folder[article/body='" + txbSearch.Text + "']"; //tried this too
tvCMSArts.DataBind();
}