Your Ad Here
首页 | 编程语言 | 网站建设 | 游戏天堂 | 冲浪宝典 | 网络安全 | 操作系统 | 软件时空 | 硬件指南 | 病毒相关 | IT 认证
软讯网络 > 编程语言 > .NET > C#.NET > ASP.NET中GridView的自定义分页
【标  题】:ASP.NET中GridView的自定义分页
【关键字】:ASP.NET,GridView
【来  源】:http://blog.csdn.net/smartyaya/archive/2007/02/08/1505157.aspx

ASP.NET中GridView的自定义分页

Your Ad Here  在ASP.NET 2.0种提供了GridView控件。该控件的分页比较方便,可以通过在Visual Studio .NET 2005种简单设置即可实现各种分页功能。

1. 默认分页方式
(1) 是否允许分页
GridView的AllowPaging属性。

(2) 每页记录数
GridViewPageSize

(3) 分页导航条形式
GridViewPagerSettings属性的Mode:Numeric,NextPrevious,NextPreviousFirstLast,NumericFirstLast。

2. 自定义分页
(1) 当前页
<asp:Label  ID="LabelCurrentPage" runat="server" 
 Text
="<%# ((GridView)Container.NamingContainer).PageIndex + 1 %>"></asp:Label> 


(2) 总页数
<asp:Label ID="LabelPageCount" runat="server" 
 Text
="<%# ((GridView)Container.NamingContainer).PageCount %>"></asp:Label> 


(3) 首页、上一页、下一页、尾页
<asp:LinkButton ID="LinkButtonFirstPage" runat="server" CommandArgument="First" CommandName="Page" 
 Visible
="<%# ((GridView)Container.NamingContainer).PageIndex != 0 %>">首页</asp:LinkButton> 

<asp:LinkButton ID="LinkButtonPreviousPage" runat="server" CommandArgument="Prev" CommandName="Page" 
 Visible
="<%# ((GridView)Container.NamingContainer).PageIndex != 0 %>">上一页</asp:LinkButton> 

<asp:LinkButton ID="LinkButtonNextPage" runat="server" CommandArgument="Next" CommandName="Page" 
 Visible
="<%# ((GridView)Container.NamingContainer).PageIndex != ((GridView)Container.NamingContainer).PageCount - 1 %>">下一页</asp:LinkButton> 

<asp:LinkButton ID="LinkButtonLastPage" runat="server" CommandArgument="Last" CommandName="Page" 
 Visible
="<%# ((GridView)Container.NamingContainer).PageIndex != ((GridView)Container.NamingContainer).PageCount - 1 %>">尾页</asp:LinkButton>
.NET源程序在IIS下调试的一个问题:【上一篇】
string.format复合格式化:【下一篇】
【相关文章】
  • [Flash FileUpload]用flash.net.FileReference实现ASP.NET无刷新文件上传
  • Microsoft AJAX Library Cheat Sheet——ASP.NET AJAX客户端框架的快速参考系列(翻译全部完成)
  • [ASP.NET AJAX]谨记给UpdatePanel中动态添加的控件赋ID
  • ASP.NET中cache控制的方法
  • ASP.NET AJAX 1.0 & AJAX Control Toolkit 在iframe中的"access denied"错误
  • ASP.NET AJAX的好东东:文档下载,后退按钮支持,新的动画控件
  • ASP.NET验证控件详解
  • vs.net2005中使用利用cdo.message发送邮件(以asp.net/c#为例)
  • 将GridView导出到Excel并防止内容乱码
  • 鸡肋烹制出的美味——真正可调试的ASP.NET AJAX
  • 【随机文章】
  • 实用的PHP加解密函数
  • 解剖WIN2K下的空会话
  • MFC使用教程——简介MFC
  • Chapter 7. BIND 的维护 (1)
  • Inside the C++ Object Model的学习
  • 一个小技巧,在http和https之间转化
  • 我知道AWT/Swing不受欢迎的根本原因了:外观不够漂亮!附图
  • FreeBSD下VI编辑器的使用
  • SWT 实现 安全保存对话框 SafeSaveDialog
  • 原形项目取得重大突破
  • 【相关评论】
    没有相关评论
    【发表评论】
    姓名:
    邮件:
    随机码*
    评论*
          
    |  首 页  |  版权声明  |  联系我们   |  网站地图  |
    CopyRight © 2004-2007 bbb软讯网络 All Rigths Reserved.