如何使用 xmldatasource 将 xml 文件绑定到 asp.net 下拉列表?如果我像下面那样做,我会看到空的下拉列表。
ASP.NET
<asp:DropDownList runat="server" ID="ddlDEMO" DataValueField="BILLAB" DataTextField="BILLAB" DataSourceID="xdsDemo">
</asp:DropDownList>
<asp:XmlDataSource ID="xdsDemo" runat="server" DataFile="~/XML/Bills.xml"
XPath="/Bills/Bill"></asp:XmlDataSource>
XML:
<?xml version="1.0" encoding="utf-8" ?>
<Bills>
<Bill>
<BILLID>1</BILLID>
<BILLAB>ONE</BILLAB>
</Bill>
</Bills>