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
>
查看全文
相关阅读:
Ubuntu 各版本代号简介
Ubuntu如何同步网络时间
Ubuntu下修改DNS重启也能用的方法
provider networks和self-service networks
openstack 架构
系统故障排除
系统日志管理
系统引导
网络管理
Linux下开启FTP服务
原文地址:https://www.cnblogs.com/darkhorse/p/815643.html
最新文章
MySQL 01
Python3 网络编程和并发编程总结
Python3 多线程爬取梨视频
Python3 并发编程4
Python3 并发编程3
Python3 并发编程小练习
Python3 并发编程2
Python3 并发编程1
Python3 网络基础基础2
ActiveMQ(3) ActiveMQ创建(simpleAuthenticationPlugin)安全认证
热门文章
ActiveMQ(2) ActiveMQ创建HelloWorld
ActiveMQ(1) 初识ActiveMQ
CentOS 6.5 Linux 安装 openoffice
Linux 安装编译 FFMPEG
SVN 服务器安装及配置(WIN7)
ContenOS 安装配置 rpm 版本 Jenkins
Linux 安装及配置 Nginx + ftp 服务器
SpringBoot入门学习(一): Idea 创建 SpringBoot 的 HelloWorld
设置 Linux 服务器中 MySQL 允许远程访问
Ubuntu解决 MariaDB无密码就可以登录的问题
Copyright © 2011-2022 走看看