首 页 ┆ 源码下载 ┆ IT学院 ┆ 字体下载 ┆ 模板下载 ┆ 源码发布 ┆ 广告合作 ┆ 网站地图 ┆ 虚拟主机 ┆ 中文域名
► 设为首页
► 加入收藏
► 联系我们
源码下载 >> ASP源码 | PHP源码 | ASP.net源码 | JSP源码 | CGI源码 | VC/C++源码 | VB源码 | Delphi源码 | Flash源码
文章学院 >> 网络编程 | 网页设计 | 图形图象 | 数据库 | 服务器 | 网络媒体 | 网络安全 | 操作系统 | 办公软件 | 软件开发 | 黑客知识
字体下载 >> 精制字体 | 非英字体 | 艺术字体 | 著名字体 | 哥特式 | 简单字体 | 手写体 | 节假日 | 图案字体 | 精度像素 | 中文字体
模板下载 >> 企业门户 | 数码网络 | 休闲娱乐 | 影视音乐 | 旅游名胜 | 文化艺术 | 电子商务 | 个性展示 | 登陆导航 | Flash模板
►►您当前的位置:源码园 → IT学院 → 网络编程 → NET专区 → 文章内容

asp+ 利用数据绑定来处理XML文件

作者:佚名  来源:不详  发布时间:2007-2-6 16:56:09
/*
豆腐制作 都是精品
http://www.asp888.net 豆腐技术站
如转载 请保留版权信息
*/
test.aspx 是主运行程序 site.xml 是包含有数据的xml 文件

<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Data" %>

<html>
<script language="VB" runat="server">
Sub Page_Load(Src As Object, E As EventArgs)
'http://www.asp888.net
Dim DS As New DataSet
Dim FS As FileStream
Dim Reader As StreamReader

FS = New FileStream(Server.MapPath("site.xml"),FileMode.Open,FileAccess.Read)
Reader = New StreamReader(FS)
DS.ReadXml(Reader)
FS.Close()
Dim Source As DataView
Source = new DataView(ds.Tables(0))
MyDataGrid.DataSource = Source
MyDataGrid.DataBind()
End Sub
</script>

<body>

<h3><font face="Verdana">技术站点一览</font> <span runat="server" id="MySpan"/></h3>

<ASP:DataGrid id="MyDataGrid" runat="server"
Width="800"
BorderColor="black"
ShowFooter="false"
CellPadding=3
CellSpacing="0"
Font-Name="Verdana"
Font-Size="8pt"
HeaderStyle-BackColor="#aaaadd"
>
<property name="Columns">
<asp:HyperLinkColumn
DataNavigateUrlField="url"
DataNavigateUrlFormatString={0}
Text="参观!"
/>
</property>
</ASP:DataGrid>


</body>
</html>

site.xml 文件的内容

<root>
<schema id="allsite" targetNamespace="" xmlns="http://www.w3.org/1999/XMLSchema" xmlns:xdo="urn:schemas-microsoft-com:xml-xdo" xdo:DataSetName="books">
<element name="sites">
<complexType content="elementOnly">
<element name="url" type="string" minOccurs="1" allownull=""></element>
<element name="site" type="string" minOccurs="1"></element>
<element name="content" type="string" minOccurs="0" maxoccurs="1"></element>
</complexType>
</element>
</schema>

<allsite>
<sites>
<url>http://www.asp888.net</url>
<site>豆腐</site>
<content>豆腐制作 都是精品</content>
</sites>
</allsite>

</root>

作者:豆腐


[] [返回上一页] [打 印]
  • 上一篇文章:给上次的DataGrid分页增加些功能!
  • 下一篇文章:两种没有使用绑定的 数据显示

  • 相关文章:
  • [图文]VC6中使用CHtmlView在对话框控制中显示HTML文...
  • ASP+MSSQL在线修改Serv-U密码--ASP,MSSQL,在线修改,...
  • 保障asp+sql站点安全的经验--保障,asp,sql,站点,安全...
  • 一次对ASP+ORACLE的注入手记--ASP,ORACLE,注入,手记...
  • [图文]ASP+MSSQL注入工具 web版 beta 3--ASP,MSSQL,...
  • 从SQL中的一个表中导出HTML文件表格
  • SQL Server中读取XML文件的简单做法
  • 根据查询结果,生成XML文件
  • 在网页XHTML文件中引入CSS样式五种方式
  • 利用ASP+JMAIL进行邮件群发的新思路
  • 如何使用ASP生成HTML文件
  • ASP+Access的安全隐患及对策
关于本站 - 网站帮助 - 广告合作 - 下载声明 - 友情连接 - 网站地图 - 源码发布
Copyright © 2003-2009 Ymyasp.Com. All Rights Reserved .
备案序号:粤ICP备07029071号