01.
DataTable rec =
new
DataTable();
02.
rec.Columns.AddRange(
new
DataColumn[] {
03.
new
DataColumn(
"id"
,
typeof
(
string
)),
04.
new
DataColumn(
"price"
,
typeof
(
string
)),
05.
new
DataColumn(
"description"
,
typeof
(
string
))
06.
});
07.
08.
XmlDocument doc =
new
XmlDocument();
09.
doc.LoadXml(returnxml);
10.
foreach
(XmlNode recNode
in
doc.GetElementsByTagName(
"detail"
))
11.
{
12.
DataRow row = rec.Rows.Add(
13.
recNode[
"id"
].InnerText,
14.
recNode[
"price"
].InnerText,
15.
recNode[
"description"
].InnerText);
16.
17.
18.
}
19.
20.
dropdownlist.DataSource = rec.DefaultView;
21.
dropdownlist.DataValueField = rec.Columns[
"id"
].ToString();
22.
dropdownlist.DataTextField = rec.Columns[
"description"
].ToString();
23.
dropdownlist.DataBind();