<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">
i am loading from xml to dropdownlist
list of all the authors
problem is this not distinct am geting more then one of each author
how do i make this dropdownlist distinct ??
i tryed to google about it and found selectcommand but i could not get it to work
it seems to be like a sql query but am not sure
hope someone here can help 🙂
Not sure if this will work for you, but you can specify the XPath property to the Xml data source: XPath=”//author[not(.=preceding::author)]”.