【发布时间】:2011-08-16 15:32:00
【问题描述】:
我需要创建一个下拉列表,将 xml 文件中的两个字段组合在一起...
XML 文件:
<?xml version="1.0" encoding="utf-8" ?>
<exchangeRates>
<rate country="aud" >0.97</rate>
<rate country="usd" >1.01</rate>
</exchangeRates>
我需要下拉列表显示国家和汇率
aud 0.97
usd 1.01
类似
SELECT country + rate AS NewColumn FROM XML above
And then use NewColumn for the DataValueFIeld:
<asp:DropDownList ID="DropDownList1" runat="server"
DataSourceID="SqlDBSrc" DataTextField="NAME" DataValueField="NewColumn"
>
<asp:XmlDataSource ID="ListItems" runat="server" DataFile="~/ExchangeRates.xml">
</asp:XmlDataSource>
如何在 asp.net 中正确执行此操作?
【问题讨论】:
标签: asp.net html xml data-binding drop-down-menu