如何将数据从xml加载到Dropdownlist? [英] how to load data from the xml to Dropdownlist?

查看:70
本文介绍了如何将数据从xml加载到Dropdownlist?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个xml文件

 <  产品 > 
<   idproduct  >  1 <  /idproduct  > 
<  名称 > 牛奶<  /name  > 
<  单位 > 可以<  /   > 
<  成本 >  $ 2 <  /cost  > 
<  /product  > 
<  产品 > 
<   idproduct  >  2 <  /idproduct  > 
<  名称 > 橙色<  /name  > 
<  单位 > <  /unit  > 
<  成本 >  $ 10 <  /cost  > 
<  /product  >  


...
如何将单元从xml加载到Dropdownlist?
我尝试像Winform C#一样使用Items.Add (node ​​[2]. InnerText)和SelectedIndexChanged.我得到了Item增加的数量.在Dropdownlist中重复了单元.

解决方案

2 /cost < /product > < 产品 > < idproduct > 2 < /idproduct > < 名称 > 橙色< /name > < 单位 > < /unit > < 成本 >

10 < /cost > < /product >


...
如何将单元从xml加载到Dropdownlist?
我尝试像winform C#一样使用Items.Add (node ​​[2]. InnerText)和SelectedIndexChanged.我得到了Item增加的数量.在Dropdownlist中重复了单元.


检查这些博客
http://geekswithblogs.net/AzamSharp/archive/2005/08/18/50567.aspx [ ^ ]
http://www.youtube.com/watch?v=lLlFOS5LA08 [<product> <idproduct>1</idproduct> <name>milk</name> <unit>can</ unit> <cost>$2</cost> </product> <product> <idproduct>2</idproduct> <name>oranges</name> <unit>barrel</unit> <cost>$10</cost> </product>


...
how to load unit from the xml to Dropdownlist?
I tried using Items.Add (node ​​[2]. InnerText) and SelectedIndexChanged like winform C #.I get number of Item increase.Unit repeat in Dropdownlist.

解决方案

2</cost> </product> <product> <idproduct>2</idproduct> <name>oranges</name> <unit>barrel</unit> <cost>


10</cost> </product>


...
how to load unit from the xml to Dropdownlist?
I tried using Items.Add (node ​​[2]. InnerText) and SelectedIndexChanged like winform C #.I get number of Item increase.Unit repeat in Dropdownlist.


check these blogs
http://geekswithblogs.net/AzamSharp/archive/2005/08/18/50567.aspx[^]
http://www.youtube.com/watch?v=lLlFOS5LA08[^]
--NDK


这篇关于如何将数据从xml加载到Dropdownlist?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆