惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

美团技术团队
博客园_首页
量子位
F
Fortinet All Blogs
L
LangChain Blog
The Cloudflare Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
大猫的无限游戏
大猫的无限游戏
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
V
Visual Studio Blog
Blog — PlanetScale
Blog — PlanetScale
博客园 - 叶小钗
Apple Machine Learning Research
Apple Machine Learning Research
博客园 - Franky
G
Google Developers Blog
阮一峰的网络日志
阮一峰的网络日志
T
Tailwind CSS Blog
WordPress大学
WordPress大学
宝玉的分享
宝玉的分享
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
有赞技术团队
有赞技术团队
U
Unit 42
IT之家
IT之家

博客园 - kingboy

miniSipServer简单而不简单,轻松落地,实现电脑对固话、手机通讯 sql 去重 C# 获取客户端信息 /asp.net/WebService/WebForm C#防止WebBrowser在新窗口中打开链接页面 常用sql语句 sql 复制表 获得 DataSet中的记录总数 MySQL安装的图解 sql 按日期查询 C#中的日期函数使用大全 火车座位分布图 javascript页面跳转常用代码 首页头部下拉广告设计(javascript) GridView加ObjectDataSource做删除事件(ObjectDataSourceStatusEventHandler 委托) GridView日期格式模版列使用方法 (转) 非常酷的三级下拉菜单!!(javascript) JavaScript 强行弹出窗口 与 无提示关闭页面 sql事务处理(转) o(∩_∩)o...哈哈 在博客园安家了!!
GridView 自定义分页
kingboy · 2008-01-16 · via 博客园 - kingboy

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

(2) 每页记录数

GridViewPageSize

(3) 分页导航条形式

GridViewPagerSettings属性的Mode:Numeric,NextPrevious,NextPreviousFirstLast,NumericFirstLast。

(4)

GridViewOnPageIndexChanging="GridView1_PageIndexChanging 
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) 首页、上一页、下一页、尾页

 

注:将上面自定义的代码写在GridView的<PagerTemplate></PagerTemplate>标签内即可。

CS页面

   protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
      {
          GridView1.PageIndex = e.NewPageIndex;
          DataBind();
      }