- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
三十三:基于DataList和Repeater使用DropDownList过滤的主从报表剖析
在ASP.NET 2.0中操作数据之三十三:基于DataList和Repeater使用DropDownList过滤的主/从报表
作者:heker2007 字体:[ HYPERLINK javascript:turnbig() 增加? HYPERLINK javascript:turnsmall() 减小] 类型:转载 时间:2016-05-09 HYPERLINK /article/83832.htm \l comments ?我要评论
前面已经介绍过使用DropDownList过滤的主/从报表,不过当时是基于GridView,本文算是复习一下,基于DataList和Repeater再次实现一下相同的功能。
导言
在前面的使用DropDownList过滤的主/从报表一章里我们使用GridView创建的主/从表,显示一些主记录.用户可以根据主记录来查看从(详细)的内容.主/从表在呈现一对多关系和含多列的表的信息时是一个好的选择.在前面我们已经学过如何使用GridView和DetailsView来实现.本章和后面两章我们将重新复习一下这些概念,但是主要学习使用DataList和Repeater来实现.本章我们将学习使用DropDownList包含主记录,而在DataList里显示从记录.
第一步: 增加主/从教程页
首先增加本教程会用到的文件夹(DataListRepeaterFiltering)和页.新建页的时候记得选择Site.master.
Default.aspxFilterByDropDownList.aspxCategoryListMaster.aspxProductsForCategoryDetails.aspxCategoriesAndProducts.aspx
图 1: 创建DataListRepeaterFiltering文件夹和页
然后打开Default.aspx页,将SectionLevelTutorialListing.ascx用户控件拖进来.
图2: 在Default.aspx页里增加SectionLevelTutorialListing.ascx
我们需要将主/从教程添加到site map里.打开Web.sitemap,将下面的标记添加到“Displaying Data with the DataList and Repeater”节点后:
HYPERLINK /article/83832.htm ?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22siteMapNode
?title=Master/Detail Reports with the DataList and Repeater
?description=Samples of Reports that Use the DataList and Repeater Controls
?url=~/DataListRepeaterFiltering/Default.aspx
??
?siteMapNode
?title=Filter by Drop-Down List
?description=Filter results using a drop-down list.
?url=~/DataListRepeaterFiltering/FilterByDropDownList.aspx /
??
?siteMapNode
?title=Master/Detail Across Two Pages
?description=Master records on one page, detail records on another.
?url=~/DataListRepeaterFiltering/CategoryListMaster.aspx /
??
?siteMapNode
?title=Maser/Detail on One Page
?description=Master records in the left column, details on the right,
???both on the same page.
?url=~/DataListRepeaterFiltering/CategoriesAndProducts.aspx /
??
/siteMapNode图 3: 更新之后的Site Map
第二步: 在DropDownList里显示Categories
我们的主/从表将在DropDownList里列出categories ,然后将选择的item的product用DataList显示出来.打开DataLis
文档评论(0)