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

推荐订阅源

The Hacker News
The Hacker News
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
雷峰网
雷峰网
人人都是产品经理
人人都是产品经理
Recent Announcements
Recent Announcements
D
DataBreaches.Net
P
Proofpoint News Feed
V
Visual Studio Blog
J
Java Code Geeks
Recorded Future
Recorded Future
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
F
Full Disclosure
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
The GitHub Blog
The GitHub Blog
Engineering at Meta
Engineering at Meta
C
Cybersecurity and Infrastructure Security Agency CISA
V
Vulnerabilities – Threatpost
罗磊的独立博客
Jina AI
Jina AI
博客园 - 【当耐特】
C
CERT Recently Published Vulnerability Notes
G
GRAHAM CLULEY
Y
Y Combinator Blog
L
LangChain Blog
L
LINUX DO - 热门话题
宝玉的分享
宝玉的分享
月光博客
月光博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
H
Help Net Security
云风的 BLOG
云风的 BLOG
C
CXSECURITY Database RSS Feed - CXSecurity.com
博客园_首页
A
About on SuperTechFans
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Latest news
Latest news
T
Threatpost
T
Tenable Blog
有赞技术团队
有赞技术团队
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Stack Overflow Blog
Stack Overflow Blog
C
Cisco Blogs
C
Check Point Blog
T
Tor Project blog
T
Threat Research - Cisco Blogs
T
The Exploit Database - CXSecurity.com
S
Schneier on Security
美团技术团队
I
Intezer
S
Securelist
AWS News Blog
AWS News Blog

博客园 - 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();
      }