GridView自带分页 1总页数 首页 下一页 上一页 尾页 X 页 go 实现方法 .
在前台GRIDVIEW中添加如下代码
<PagerTemplate>
<table>
<tr>
<td style="text-align: right">
第<asp:Label ID="lblPageIndex" runat="server" Text="<%#((GridView)Container.Parent.Parent).PageIndex + 1 %>"></asp:Label>页
共<asp:Label ID="lblPageCount" runat="server" Text="<%# ((GridView)Container.Parent.Parent).PageCount %>"></asp:Label>页
<asp:LinkButton ID="btnFirst" runat="server" CausesValidation="False" CommandArgument="First" CommandName="Page" Text="首页"> </asp:LinkButton>
<asp:LinkButton ID="btnPrev" runat="server" CausesValidation="False" CommandArgument="Prev" CommandName="Page" Text="上一页"></asp:LinkButton>
<asp:LinkButton ID="btnNext" runat="server" CausesValidation="False" CommandArgument="Next" CommandName="Page" Text="下一页"></asp:LinkButton>
<asp:LinkButton ID="btnLast" runat="server" CausesValidation="False" CommandArgument="Last" CommandName="Page" Text="尾页"></asp:LinkButton>
<asp:TextBox ID="txtNewPageIndex" runat="server" Text="<%# ((GridView)Container.Parent.Parent).PageIndex + 1%>" Width="20px"></asp:TextBox>
<asp:LinkButton ID="btnGo" runat="server" CausesValidation="False" CommandArgument="-1" CommandName="Page" Text="GO"></asp:LinkButton>
</td>
</tr>
</table>
</PagerTemplate>
后台代码添加如下代码
protected void PageIndexChanging(object sender, GridViewPageEventArgs e)
{
GridView gvw = (GridView)sender;
if (e.NewPageIndex < 0)
{
TextBox pageNum = (TextBox)gvw.BottomPagerRow.FindControl("txtNewPageIndex"); int Pa = int.Parse(pageNum.Text);
if (Pa <= 0) { gvw.PageIndex = 0; }
else { gvw.PageIndex = Pa - 1; }
}
else { gvw.PageIndex = e.NewPageIndex; }
GetBind();//你绑定数据的方法
}
GridView自带分页 1总页数 首页 下一页 上一页 尾页 X 页 go 实现方法 .的更多相关文章
- 使用GridView自带分页的代码
关于GridView分页页码的讨论 在GridView中实现分页的效果方法非常easy,仅仅须要在"GridView任务"对话框中进行设置就能够了.在"GridView任 ...
- GridView总结一:GridView自带分页及与DropDownList结合使用
GridView自带的分页功能实现: 要实现GrdView分页的功能 操作如下: 1.更改GrdView控件的AllowPaging属性为true. 2.更改GrdView控件的PageSize属性为 ...
- mysql 数据库封装类:返回索引、关联、字符串数组;分页查询封装类 :$page=new Page(表的总条数,每页的条数);$sql = "".$page->limit; echo $page->fpage();
<?php class czy { public $host="localhost"; //地址 public $uid="root"; //用户名 pu ...
- Yii2.0 多条件搜索 带分页
方法一 在控制器中 ; if($titles!=""){ $where.=" and title lik ...
- 使用for或while循环来处理处理不确定页数的网页数据爬取
本文转载自以下网站: Python For 和 While 循环爬取不确定页数的网页 https://www.makcyun.top/web_scraping_withpython16.html 需 ...
- dotnet获取PDF文件的页数
#region 获取PDF文件的页数 private int BytesLastIndexOf(Byte[] buffer, int length, string Search) { if (buff ...
- C# 返回分页查询的总页数
/// <summary> /// 返回分页查询操作的的总页数 /// </summary> /// <param name="count">总 ...
- easyui分页时,总页数出错
错误出现 MyBatis用easyui写后台分页代码时,出现翻页后显示总页数错误 代码如下 可能原因在于后台mappers.xml里的sql语句错误 <select id="getPr ...
- mvc自定义分页(加页数的)(转)
1.引言 在MVC开发中我们经常会对数据进行分页的展示.通过分页我们可以从服务端获取指定的数据来进行展示.这样既节约了数据库查询的时间也节约了网络传输的数据量.在MVC开发中使用的比较多的应该是MVC ...
随机推荐
- Codeforces Round #306 (Div. 2) B. Preparing Olympiad dfs
B. Preparing Olympiad Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/550 ...
- thinkphp关联查询
$list=$model->table("$dName d ,$mName m,$cName c") ->field('d.*,m.title as musicTitl ...
- [Angular 2] Controlling Rx Subscriptions with Async Pipe and BehaviorSubjects
Each time you use the Async Pipe, you create a new subscription to the stream in the template. This ...
- c++笔试题两道,求解当中一道
1.Implement a functionthat prints the numbers from 1 to 100.But for multiples of three(3) print &quo ...
- android ListView 中getview学习总结
最近在做android相关的开发,ListView中有一个图片错位的问题,今天查了很多人写的一些东西,所以记录下来,算是一种加深理解吧. ListView是一个非常常用的控件,功能可以扩展的很丰富,而 ...
- purge
RR级别 mysql V5.6 debug ; 测试1 会话1: mysql)); Query OK, rows affected (0.04 sec) mysql,"a"); Q ...
- 源码分析:静态分析 C 程序函数调用关系图
http://www.tinylab.org/callgraph-draw-the-calltree-of-c-functions/
- IPC——数据报套接字通信
Linux进程间通信——使用数据报套接字 前一篇文章,Linux进程间通信——使用流套接字介绍了一些有关socket(套接字)的一些基本内容,并讲解了流套接字的使用,这篇文章将会给大家讲讲,数据报套接 ...
- 如何设计App登录模块?
1.熟悉目前常见的手机APP登陆方式 ① 账号登陆(手机.邮箱) ② 第三方登陆(微信,QQ,微博) ③ 一键快捷登录(工具类,如不记单词) ④ 游客登陆(bbs) ⑤ demo测试登陆(如友盟等) ...
- C# 读取文件的修改时间、访问时间、创建时间
C# 获取文件的各个时间如下: 表2<ccid_nobr> 属性 功能和用途 Attributes 返回和文件相关的属性值,运用了FileAttributes枚举类型值 CreationT ...