zoukankan
html css js c++ java
Asp.Net2.0数据绑定之XmlDataSource控件
XML文件
:
<?
xml version="1.0" encoding="gb2312"
?>
<?
xml-stylesheet type="text/xsl" href="XSLTemplate.xsl"
?>
<
Books
>
<
BookItem
>
<
BookName
>
Coding With C#
</
BookName
>
<
Author
>
darkhorse
</
Author
>
<
Price
>
20
</
Price
>
</
BookItem
>
<
BookItem
>
<
BookName
>
Coding With VB
</
BookName
>
<
Author
>
Cherry
</
Author
>
<
Price
>
25
</
Price
>
</
BookItem
>
<
BookItem
>
<
BookName
>
Coding With Java
</
BookName
>
<
Author
>
LiuDong
</
Author
>
<
Price
>
30
</
Price
>
</
BookItem
>
<
BookItem
>
<
BookName
>
Coding With JavaScript
</
BookName
>
<
Author
>
DongSheng
</
Author
>
<
Price
>
35
</
Price
>
</
BookItem
>
</
Books
>
Asp.Net页面文件
:
<%
@ Page Language
=
"
C#
"
%>
<!
DOCTYPE html PUBLIC
"
-//W3C//DTD XHTML 1.0 Transitional//EN
"
"
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd
"
>
<
script runat
=
"
server
"
>
</
script
>
<
html xmlns
=
"
http://www.w3.org/1999/xhtml
"
>
<
head runat
=
"
server
"
>
<
title
>
Asp.Net2.0中的数据绑定
</
title
>
</
head
>
<
body
>
<
form id
=
"
form1
"
runat
=
"
server
"
>
<
div
>
&
nbsp;
&
nbsp;
<
asp:XmlDataSource ID
=
"
XmlDataSource1
"
runat
=
"
server
"
DataFile
=
"
~/App_Data/BookXML.xml
"
XPath
=
"
Books/BookItem
"
></
asp:XmlDataSource
>
<
asp:GridView ID
=
"
GridView1
"
runat
=
"
server
"
DataSourceID
=
"
XmlDataSource1
"
AutoGenerateColumns
=
"
False
"
BackColor
=
"
White
"
BorderColor
=
"
#E7E7FF
"
BorderStyle
=
"
None
"
BorderWidth
=
"
1px
"
CellPadding
=
"
3
"
GridLines
=
"
Horizontal
"
>
<
Columns
>
<
asp:TemplateField HeaderText
=
"
书名
"
>
<
ItemTemplate
>
<%
# XPath(
"
BookName
"
)
%>
</
ItemTemplate
>
</
asp:TemplateField
>
<
asp:TemplateField HeaderText
=
"
作者
"
>
<
ItemTemplate
>
<%
# XPath(
"
Author
"
)
%>
</
ItemTemplate
>
</
asp:TemplateField
>
<
asp:TemplateField HeaderText
=
"
价格
"
>
<
ItemTemplate
>
<%
# XPath(
"
Price
"
)
%>
</
ItemTemplate
>
</
asp:TemplateField
>
</
Columns
>
<
FooterStyle BackColor
=
"
#B5C7DE
"
ForeColor
=
"
#4A3C8C
"
/>
<
RowStyle BackColor
=
"
#E7E7FF
"
ForeColor
=
"
#4A3C8C
"
/>
<
SelectedRowStyle BackColor
=
"
#738A9C
"
Font
-
Bold
=
"
True
"
ForeColor
=
"
#F7F7F7
"
/>
<
PagerStyle BackColor
=
"
#E7E7FF
"
ForeColor
=
"
#4A3C8C
"
HorizontalAlign
=
"
Right
"
/>
<
HeaderStyle BackColor
=
"
#4A3C8C
"
Font
-
Bold
=
"
True
"
ForeColor
=
"
#F7F7F7
"
/>
<
AlternatingRowStyle BackColor
=
"
#F7F7F7
"
/>
</
asp:GridView
>
</
div
>
</
form
>
</
body
>
</
html
>
查看全文
相关阅读:
python setup.py install 失败
Python xlsx 读取
Java ArrayList Sort
java console ( mac osx ) 命令行编码
Lucene Query Term Weighting
Fast Intro To Java Programming (2)
随感 20150512
循环数组中找查找某个数值
数字内组合得到下一个比该数大的数
android activity空指针异常解决问题解决
原文地址:https://www.cnblogs.com/darkhorse/p/815643.html
最新文章
对ajax的hack的分析
对于[]()+!的研究
jquery 的缺点
target,currentTarget,delegateTarget,srcElement
html table 知识点
propertychange input change
利用Range改变光标位置
【译】发送表单数据
移动开发流量省起来之Zepto
mac下递归创建ctags报错: "illegal option -- R"
热门文章
简单的php自定义错误日志
linux下使用cronjob定时执行php脚本
pear中几个实用的xml代码库
php的curl也没这么复杂
Apache之.htaccess备忘录(二)
关于THINKPHP的addAll支持的最大数据量
HTTP状态码大全
深入理解RESTful Web Services
Distributed Sentence Similarity Base on Word Mover's Distance
Java 简繁转换 ZHConverter
Copyright © 2011-2022 走看看