Jquery中文网 www.jquerycn.cn
Jquery中文网 >  脚本编程  >  Asp.net  >  正文 ASP.NET -Repeater控件

ASP.NET -Repeater控件

发布时间:2018-10-01   编辑:www.jquerycn.cn
jquery中文网为您提供ASP.NET -Repeater控件等资源,欢迎您收藏本站,我们将为您提供最新的ASP.NET -Repeater控件资源

ASP.NET -R epeater控件

Repeater控件是用来显示一个重复的项目清单是必然的控制。

一个DataSet绑定到中继控制
Repeater控件是用来显示一个重复的项目清单是必然的控制。 Repeater控件可绑定到数据库表,一个XML文件,或其他的物品清单。在这里,我们将展示如何结合XML文件的Repeater控制。

我们将使用下面的XML文件在我们的例子( “ cdcatalog.xml ” ) :

<pre><?xml version="1.0" encoding="ISO-8859-1"?></pre> <pre><catalog> <cd> <title>Empire Burlesque</title> <artist>Bob Dylan</artist> <country>USA</country> <company>Columbia</company> <price>10.90</price> <year>1985</year> </cd> <cd> <title>Hide your heart</title> <artist>Bonnie Tyler</artist> <country>UK</country> <company>CBS Records</company> <price>9.90</price> <year>1988</year> </cd> <cd> <title>Greatest Hits</title> <artist>Dolly Parton</artist> <country>USA</country> <company>RCA</company> <price>9.90</price> <year>1982</year> </cd> <cd> <title>Still got the blues</title> <artist>Gary Moore</artist> <country>UK</country> <company>Virgin records</company> <price>10.20</price> <year>1990</year> </cd> <cd> <title>Eros</title> <artist>Eros Ramazzotti</artist> <country>EU</country> <company>BMG</company> <price>9.90</price> <year>1997</year> </cd> </catalog></pre> <pre>

看看XML文件: cdcatalog.xml

首先,进口的“ System.Data ”命名空间。我们需要这种命名与DataSet对象。包括下列指令上方的一个。 aspx页:

“ % @导入命名= ” System.Data “ % ”

下一步,创建一个DataSet的XML文件,并加载XML文件到DataSet网页时首先加载:

<pre><script runat="server"> sub Page_Load if Not Page.IsPostBack then dim mycdcatalog=New DataSet mycdcatalog.ReadXml(MapPath("cdcatalog.xml")) end if end sub</pre>
</pre>

您可能感兴趣的文章:
ASP.NET -Repeater控件
asp.net Repeater取得CheckBox选中的某行某个值
ASP.NET程序中用Repeater实现分页
基于jquery的Repeater实现代码
repeater或DataList控件简单应用
ASP.NET中实现模版的动态加载
asp.net Repeater嵌套绑定详细做法
asp.net List数据源之 repeater分页
Repeater和GridView支持DataPager分页做法
jquery last-child 列表最后一项的样式

[关闭]