1
<?
xml version="1.0" encoding="utf-8"
?>
2 < DdlFeeData >
3 < Content >
4 < name > 总费用 </ name >
5 < value > should_pay </ value >
6 </ Content >
7 < Content >
8 < name > 加工费 </ name >
9 < value > process_fee </ value >
10 </ Content >
11 </ DdlFeeData >
12
代码:
2 < DdlFeeData >
3 < Content >
4 < name > 总费用 </ name >
5 < value > should_pay </ value >
6 </ Content >
7 < Content >
8 < name > 加工费 </ name >
9 < value > process_fee </ value >
10 </ Content >
11 </ DdlFeeData >
12
1
///
<summary>
2 /// 从XML文件读取数据绑定到列表控件
3 /// </summary>
4 /// <remarks> Code by 旋律游魂 </remarks>
5 /// <param name="filepath"> XML文件路径 </param>
6 /// <param name="nodeString"> 结点 </param>
7 /// <param name="lic"> ListControl ID </param>
8 public void ReadXMLBindListControl( string filepath, string nodePath,System.Web.UI.WebControls.ListControl lic)
9 {
10 lic.Items.Clear();
11 XmlDocument doc = new XmlDocument();
12 doc.Load(filepath);
13 XmlNodeList nodeList = doc.SelectNodes(nodePath);
14
15 foreach (XmlNode node in nodeList)
16 lic.Items.Add( new ListItem(node.ChildNodes[ 0 ].InnerText,node.ChildNodes[ 1 ].InnerText));
17 }
2 /// 从XML文件读取数据绑定到列表控件
3 /// </summary>
4 /// <remarks> Code by 旋律游魂 </remarks>
5 /// <param name="filepath"> XML文件路径 </param>
6 /// <param name="nodeString"> 结点 </param>
7 /// <param name="lic"> ListControl ID </param>
8 public void ReadXMLBindListControl( string filepath, string nodePath,System.Web.UI.WebControls.ListControl lic)
9 {
10 lic.Items.Clear();
11 XmlDocument doc = new XmlDocument();
12 doc.Load(filepath);
13 XmlNodeList nodeList = doc.SelectNodes(nodePath);
14
15 foreach (XmlNode node in nodeList)
16 lic.Items.Add( new ListItem(node.ChildNodes[ 0 ].InnerText,node.ChildNodes[ 1 ].InnerText));
17 }
调用:
ReadXMLBindListControl(Server.MapPath(
"
DdlInfoData.xml
"
),
"
DDLInfoList/Content
"
,DdlqueryDetail);