易截截图软件、单文件、免安装、纯绿色、仅160KB

asp.net 读取Xml文件并进行DropDownList数据绑定

<asp:DropDownList ID="compactType" runat="server" AutoCallBack="True" Width="153px"> </asp:DropDownList>

<?xml version="1.0" encoding="utf-8" ?>
<roots>
<root>
<id>1</id>
<Culture>初中以下</Culture>
</root>
<root>
<id>2</id>
<Culture>初中</Culture>
</root>
<root>
<id>3</id>
<Culture>中专</Culture>
</root>
<root>
<id>4</id>
<Culture>高中</Culture>
</root>
<root>
<id>5</id>
<Culture>大专</Culture>
</root>
<root>
<id>6</id>
<Culture>本科</Culture>
</root>
</roots>

/// <summary>
/// 读取xml文件,用数据填充DropDownList,进行绑定
/// </summary>
/// <param name="path">xml文件路径</param>
/// <param name="dp">要进行绑定的DropDownList名称</param>
/// <param name="id">DropDownList要显示的文本(xml文件的一个节点)</param>
/// <param name="val">DropDownList要显示的值(xml文件的一个节点)</param>
public void ReadXml(string path,DropDownList dp,string id,string val)
{
DataSet ds = new DataSet();
ds.ReadXml(path);
dp.DataSource = ds;
dp.DataTextField = id ;
dp.DataValueField = val;
dp.DataBind();
}

SecurityFactory sf = new SecurityFactory();
//xml文件路径
string path2 = Server.MapPath("./xml/XMLFile2.xml");
sf.ReadXml(path2, this.compactType, "id", "val");


相关文档:

Perl解析XML文件时的字符集编码问题

http://stackoverflow.com/questions/1112828/cannot-decode-string-with-wide-characters-appears-on-a-weird-place
http://man.ddvip.com/web/xmlzhzn/xml_cn/xml_encoding.asp.htm
http://bbs.xml.org.cn/dispbbs.asp?boardID=8&ID=7226
http://topic.csdn.net/t/20030909/13/2240153.html
#
http://www.ezloo. ......

使用JOX 进行JavaBean和XML的转换

今天试了个XML和JavaBean转换的软件JOX,之前一直有这样的需求,但比较来比较去还是这个比较简单实用。我想除非我有WS的需求,否则象JIBX和APACHE 的WS工具对我来说都是重量级的。
先看看输出结果:
<?xml version="1.0" encoding="ISO-8859-1"?>
<ApproxItem java-class="com.greatwall.csi.np.model.Approx ......

XML字符串和XML文档之间的自由转换

本文系转载,谨向转载处空间拥有者及源出处文章作者表示感谢!
转载处:http://henry19890701.javaeye.com/blog/481462
源出处:http://www.ziliaonet.com/tech/netprogramme/XML/200605/69398.html
在做一般的XML数据交换过程中,我更乐意传递XML字符串,而不是格式化的XML Document。这就涉及到XML字符串和Xml Docume ......

ASP.NET单值和列表控件的数据绑定

一、(单值绑定)在页面的后台代码中定义公有变量,如下:
 public string gongYou = "声明的公有成员";
 ①然后在页面的源中调用,如下:
<asp:Label ID="lblMgs" runat="server" Text="<%#gongYou >"></asp:Label>
  ②当然最后要记得绑定数据:
 protected void Page_Load(object ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号