《ASP.NET1200例》ListView 控件与DataPager控件的结合<一>

<asp:ListView ID="_moviesGrid"
runat="server" DataKeyNames="movie_id"
DataSourceID="_moviesDataSource">
<LayoutTemplate>
<!-- ... -->
<div class="Pagination">
<asp:DataPager ID="_moviesGridDataPager" runat="server">
<Fields>
<asp:NumericPagerField />
</Fields>
</asp:DataPager>
</div>
</LayoutTemplate>
</asp:ListView>
- NumericPagerField 显示 1 2 3... 分页界面。
- NextPreviousPagerField 显示“Next”(下一页)、“Previous”(上一页)、“First”(第一页)和“Last”(最后一页)按钮在行间往复。
- TemplatePagerField 让您使用 PagerTemplate 定义精确设计和实现分页接口的功能。
public interface IPageableItemContainer
{
event EventHandler<PageEventArgs> TotalRowCountAvailable;
void SetPageProperties(int startRowIndex, int maximumRows,
bool databind);
int MaximumRows { get; }
int StartRowIndex { get; }
}
<asp:DataPager ID="_moviesGridDataPager" runat="server"
QueryStringField="pageNum" >
<Fields>
<asp:NumericPagerField />
</Fields>
</asp:DataPager>
Figure 8 Sorting in ListView<asp:ListView ID="_moviesGrid" runat="server" DataKeyNames="movie_id"
DataSourceID="_moviesDataSource">
<LayoutTemplate>
<div class="PrettyGrid">
<table cellpadding="0" cellspacing="0" summary="">
<thead>
<tr>
<th scope="col">
<asp:LinkButton ID="_movieIdSortLink"
CommandName="Sort" CommandArgument="movie_id"
runat="server">ID</asp:LinkButton>
</th>
<th scope="col">
<asp:LinkButton ID="_titleSortLink"
CommandName="Sort" CommandArgument="title"
runat="server">Title</asp:LinkButton>
</th>
<th scope="col">
<asp:LinkButton ID="_releaseDateSortLink"
CommandName="Sort" CommandArgument="release_date"
runat="server">Release date</asp:LinkButton>
</th>
</tr>
</thead>
<!-- ... -->
</LayoutTemplate>
</asp:ListView>
Figure 10 Defining Rows with GroupTemplate<asp:ListView ID="_groupListView" runat="server"
DataKeyNames="movie_id" DataSourceID="_moviesDataSource"
GroupItemCount="4" >
<GroupTemplate>
<tr>
<asp:PlaceHolder runat="server" ID="itemPlaceholder" />
</tr>
</GroupTemplate>
<LayoutTemplate>
<table>
<asp:PlaceHolder ID="groupPlaceholder" runat="server" />
</table>
</LayoutTemplate>
<ItemTemplate>
<td>
movie_id:
<asp:Label ID="_movie_idLabel" runat="server"
Text='<%# Eval("movie_id") %>' /> <br />
title:
<asp:Label ID="_titleLabel" runat="server"
Text='<%# Eval("title") %>' /> <br />
release_date:
<asp:Label ID="_release_dateLabel" runat="server"
Text='<%# Eval("release_date", "{0:d}") %>' /> <br />
<br />
</td>
</ItemTemplate>
</asp:ListView>
《ASP.NET1200例》ListView 控件与DataPager控件的结合<一>的更多相关文章
- 《ASP.NET1200例》实现投票的用户控件
用户控件ascx <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="24 ...
- 《ASP.NET1200例》ListView 控件与DataPager控件的结合<二>
ASP.NET使用ListView数据绑定控件和DataPager实现数据分页显示 为什么使用ListView+DataPager的方式实现分页显示? .net提供的诸多数据绑定控件,每一种都有它自己 ...
- 《ASP.NET1200例》ListView控件之修改,删除与添加
aspx <body> <form id="form1" runat="server"> <div> <asp:Lis ...
- 《ASP.NET1200例》各种类型文件汇总
aspx是页面文件 ascx是用户控件,用户控件必须嵌入到aspx中才能使用. ascx是用户控件,相当于模板 其实ascx你可以理解为Html里的一部分代码, 只是嵌到aspx里而已, 因为aspx ...
- 《ASP.NET1200例》解决母版页报错“内容控件必须是内容页中的顶级控件,或是引用母版页的嵌套母版页。”
VS2005下,添加了母版页这个控件,我们可以讲N个页面中共同的部分放在母版页来实现,并让WEB窗体集成自我们的母版页,就可以让我们的站点具有统一的风格了.在VS2005SP1之前的版本中,我们只能创 ...
- 《ASP.NET1200例》嵌套在DataLisT控件中的其他服务器控件---DropDownList控件的数据绑定
aspx <script type="text/javascript"> function CheckAll(Obj) { var AllObj = document. ...
- 《ASP.NET1200例》高亮显示ListView中的数据行并自动切换图片
aspx <script type="text/javascript"> var oldColor; function SetNewColor(Source) { ol ...
- 《ASP.NET1200例》在DataList里编辑和删除数据
学习内容:如何创建一个支持编辑和删除数据的DataList.增加编辑和删除功能需要在DataList的ItemTemplate和EditItemTemplate里增加合适的控件,创建对应的事件处理,读 ...
- 《ASP.NET1200例》<asp:DataList>分页显示图片
aspx页面代码 <asp:DataList ID="dlPhoto" runat="server" Height="137px" W ...
随机推荐
- upstream 负载均衡
首先拿一个实例来进行记录 upstream webyz { ip_hash; server 10.23.24.10:8026 weight=1 max_fails=2 fa ...
- 在CentOS上安装Git
文章引用 :http://www.ccvita.com/370.html CentOS的yum源中没有git,只能自己编译安装,现在记录下编译安装的内容,留给自己备忘. 确保已安装了依赖的包 yum ...
- poj2528 线段树+离散化
由于坐标可能很大,此时需要离散化,将值转化为对应的坐标. #include<stdio.h> #include<algorithm> using namespace std; ...
- Hibernate-入门教程
首先了解hibernate的目录结构 . +lib antlr.jar cglib-full.jar asm.jar asm-attrs.jars commons-collections.jar co ...
- struts2中怎么把action中的值传递到jsp页面
对于如何把struts2的action中的值传到jsp页面中,主要的方法有2种: 使用转发视图利用request域中储存所需的值 使用重定向时存储数据进入session使其在jsp中可以获得 下面,让 ...
- [IOS+PHP Jason格式的发送与解析]
服务器端PHP文件connect.php: <?php $q = mysql_connect("localhost","root","" ...
- sixsix团队“餐站”应用M2阶段发布报告
一.新功能 客户端 搜索功能 我们在M2中实现了对地点的搜索菜品,可以直接在主页页面中的输入框输入用户喜欢的菜品,系统将返回与对应关键字所对应的选择,更加高效直观的满足客户的口味. 菜品图片加载 我们 ...
- MyEclipse修改项目名称后,部署到 tomcat问题
问题描述: 修改项目名称后,部署到tomcat问题 解决方案: 项目->属性->myelcipse->web下,修 改web context root就可! 要在eclipse里面改 ...
- Linux VPS新硬盘分区与挂载教程
通过fdisk -l我们可以看到/dev/xvdb(此名称因系统而异)容量有23.6G,而且没有分区,接下来我们对它进行分区和挂载 (红色字为需要输入的部分,黑色字为系统显示部分) 1.fdisk - ...
- DFS & BFS
DFS 深度优先 BFS 广度优先 DFS或者BFS都是在联通区域内遍历节点的方法 用在二叉树上DFS有preOreder,inOrder,postOrder,BFS就是层次遍历. 在二叉树上的节点, ...