2012-03-25 8 views
0
<asp:XmlDataSource ID="XmlDataSource2" runat="server" 
      DataFile="~/App_Data/XMLFile1.xml" TransformFile="XSLTFile1.xslt"></asp:XmlDataSource>   
     <asp:DropDownList ID="DropDownList1" runat="server" 
      DataSourceID="XmlDataSource2" DataTextField="author" 
      DataValueField="author" 
      onselectedindexchanged="DropDownList1_SelectedIndexChanged" 
      AutoPostBack="True"> 
     </asp:DropDownList> 

<?xml version="1.0"?> 
<catalog> 
    <book id="bk101"> 
    <author>Gambardella, Matthew</author> 
    <title>XML Developer's Guide</title> 
    <genre>Computer</genre> 
    <price>44.95</price> 
    <publish_date>2000-10-01</publish_date> 
    <description> 
     An in-depth look at creating applications 
     with XML. 
    </description> 
    </book> 
    <book id="bk102"> 
    <author>Ralls, Kim</author> 
    <title>Midnight Rain</title> 
    <genre>Fantasy</genre> 
    <price>5.95</price> 
    <publish_date>2000-12-16</publish_date> 
    <description> 
     A former architect battles corporate zombies, 
     an evil sorceress, and her own childhood to become queen 
     of the world. 
    </description> 
    </book> 
    <book id="bk103"> 

私は
問題は、これが明瞭ではないすべての著者が、私はこのドロップダウンリストが別個作るのですかどのように各著者
のもっとそして1をgeting午前の
リストをDropDownListコントロールするために、XMLからロードしています??
は、私はそれについてGoogleにしようと試みとでSelectCommandを見つけましたが、私はそれはSQLクエリのようなもののようですが、ここで
希望の誰かが、この場合:)のDropDownList

答えて

0

わからない助けることができるかわからない
を動作させることができませんでしたXPathプロパティをXmlデータソースに指定することができます。XPath = "// author [not(。= preceding :: author)]"

<asp:XmlDataSource ID="XmlDataSource2" runat="server" 
      DataFile="~/App_Data/XMLFile1.xml" XPath="//author[not(.=preceding::author)]"></asp:XmlDataSource>  
+0

よく分かりましたが、xpathはちょっとしたものでしたが、それは動作します:)/*/book [not(@author = preceding-sibling :: book/@ author)] – user1246950