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
>
查看全文
相关阅读:
总结在Visual Studio Code创建Node.js+Express+handlebars项目
【转】nodeJs学习之项目结构
jquery新版本旧版本之间的坑
bootstrap使用中遇到的坑
dataTables基础函数变量
tabales1.10版参数详解
【转】自定义(滑动条)input[type="range"]样式
dataTables工作总结
转载---SpringBoot+Maven多模块项目(创建、依赖、打包可执行jar包部署测试)完整流程
MVC模式下的跨域问题
原文地址:https://www.cnblogs.com/darkhorse/p/815643.html
最新文章
本地数据Store。Cookie,Session,Cache的理解。Timer类主要用于定时性、周期性任务 的触发。刷新Store,Panel
带参方法的执行:普通方法的查询,可为空方法的查询。批量处理SQL语句。
分页查询和分页缓存查询,List<Map<String, Object>>遍历和Map遍历
Java Controller下兼容xls和xlsx且可识别合并单元格的excel导入功能
Oracle 递归的写法(start with) 以及where条件作用域
MyBatis Mapper.xml文件中 $和#的区别
D3.js 力导向图(小气泡围绕中心气泡)
Jquery EasyUI环境下设置下拉框选中指定选项
JQuery 记第N次被坑
JavaScript 元素的插入顺序以及动态加载js
热门文章
Jquery 《不想工作系列》--整理一下append、prependTo、after的区别
Java 面试题
[转载]SQL Server如何保证可空字段中非空值唯一
asp.net js获取控件ID
SQL SERVER全面优化-------Expert for SQL Server 诊断系列
C# in depth学习(1)
巩固基础知识,从C# in depth开始
Sql Server参数化查询之where in和like实现详解
[转]精选!15个必备的VSCode插件
总结在Visual Studio Code运行node.js项目遇到的问题
Copyright © 2011-2022 走看看