All articles| All Pictures| All Softwares| All Video| Go home page| Write articles| Upload pictures

Reading number is top 10 articles
SQL循序渐进(20)Aliases,、In以及子查询_[SQL,Server教程]
PHP函数学习之PHP函数点评_php资料_编程技术
delphi坐标映射
Linux环境下如何使用PHP处理图像_[PHP教程]
ASP.NET代码控制页面部分元素隐藏与显示_[Asp.Net教程]
编写XHTML需要注意的问题以及和HTML的区别_[Html教程]
Delphi使用ADO连接SQL Server 2000数据库
PHP入门:初学来看配置文件PHP.INI的中文注释_[PHP教程]
PHP教程:简单学习动态网页制作PHP中的Cookies_[PHP教程]
SQL,Server使用Bulk,Insert把一个文本导入到数据库_mssql学习_编程技术
Reading number is top 10 pictures
yy365网站上的美女2
No trading, no killing
A beautiful girl to bud3
Summer is most suitable for young people to travel in China1
The household of rural style is designed
The real super beauty9
玩手机对身体不好
Ashlynn Brooke a group sexy photo4
Look for from human art net, is good--3
为什么别人说你是疯子
Download software ranking
终极变速大师Speeder3.26
The king of fighters 97(Mobile phone games-apk)
C#COM编程指南
XML+Web+Service开发教程
天龙八部十二宫服务端
虚拟机5.5.3版
Unix video tutorial11
好色的外科大夫
Unix video tutorial3
Wild things 2
delv published in(发表于) 2014/1/23 3:13:28 Edit(编辑)
从XML文件中读取数据绑定到DropDownList_[Asp.Net教程]

从XML文件中读取数据绑定到DropDownList_[Asp.Net教程]

从XML文件中读取数据绑定到DropDownList_[Asp.Net教程]

1 、绑定DropDownList:


以下为引用的内容:
ddl_language.DataSource = createDataSource();
ddl_language.DataTextField = "languageTextField";
ddl_language.DataValueField = "languageValueField";
ddl_language.DataBind();

2、上面用到的createDataSource()方法:


以下为引用的内容:
private ICollection createDataSource()
{
//create a data table to store the data for the ddl_langauge control
DataTable dt = new DataTable();

//define the columns of the table
dt.Columns.Add("languageTextField",typeof(string));
dt.Columns.Add("languageValueField",typeof(string));

//read the content of the xml file into a DataSet
DataSet lanDS = new DataSet();
string filePath = ConfigurationSettings.AppSettings["LanguageXmlFile"];
lanDS.ReadXml(filePath);

if(lanDS.Tables.Count > 0)
{
foreach(DataRow copyRow in lanDS.Tables[0].Rows)
{
dt.ImportRow(copyRow);
}
}

DataView dv = new DataView(dt);

return dv;
}

3、Web.config


以下为引用的内容:





4、Languages.xml


以下为引用的内容:




en-US
English


zh-CN
中文


ja-JP
日语



来源:网络







添加到del.icio.us 添加到新浪ViVi 添加到百度搜藏 添加到POCO网摘 添加到天天网摘365Key 添加到和讯网摘 添加到天极网摘 添加到黑米书签 添加到QQ书签 添加到雅虎收藏 添加到奇客发现 diigo it 添加到饭否 添加到飞豆订阅 添加到抓虾收藏 添加到鲜果订阅 digg it 貼到funP 添加到有道阅读 Live Favorites 添加到Newsvine 打印本页 用Email发送本页 在Facebook上分享


Disclaimer Privacy Policy About us Site Map

If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.