ASPNETPager常用属性
<webdiyer:AspNetPager ID="pager" runat="server" class="page" FirstPageText="首页" LastPageText="尾页" PageIndexBoxType="DropDownList"
NextPageText="后页" PageSize="20" PrevPageText="前页" ShowPageIndexBox="Always" TextAfterPageIndexBox="页"
TextBeforePageIndexBox="跳转到: " Width="100%" PagingButtonType="Image" ImagePath="/SysManager/images/"
NumericButtonType="Text" ButtonImageExtension=".jpg" CustomInfoHTML="共%PageCount%页,当前为第%CurrentPageIndex%页,每页%PageSize%条 共 %RecordCount% 条数据"
ShowCustomInfoSection="Right" AlwaysShow="True" MoreButtonType="Text" OnPageChanged="Pager_PageChanged" >
</webdiyer:AspNetPager>
<%-- <webdiyer:AspNetPager ID="pager" runat="server" class="page" EnableTheming="true"
FirstPageText="首页" LastPageText="尾页" NextPageText="后页" OnPageChanged="Pager_PageChanged"
PageIndexBoxType="DropDownList" PageSize="2" PrevPageText="前页" ShowPageIndexBox="Always"
TextAfterPageIndexBox="页" TextBeforePageIndexBox="跳转到: " Width="100%" NumericButtonType="Text"
CustomInfoHTML="共%PageCount%页,当前为第%CurrentPageIndex%页,每页%PageSize%条 共%RecordCount%条数据" ShowCustomInfoSection="Right"
AlwaysShow="True">
</webdiyer:AspNetPager>--%>
<webdiyer:aspnetpager id="AspNetPager1" runat="server" alwaysshow="True" PageSize="5" custominfosectionwidth="20%" custominfotextalign="Right" firstpagetext="第一页" horizontalalign="Left" lastpagetext="末一页" navigationbuttontype="Image" nextpagetext="后一页" pageindexboxtype="TextBox" pagingbuttonspacing="8px" prevpagetext="前一页" showcustominfosection="Right" showpageindexbox="Always" textafterpageindexbox="页" UrlPaging="true" textbeforepageindexbox="跳到第" width="97%" onpagechanged="AspNetPager1_PageChanged"> </webdiyer:aspnetpager> alwaysshow:总是显示分页控件; PageSize:指定每页显示的记录数; custominfosectionwidth:用户自定义信息区的宽度; custominfotextalign:用户自定义信息区的对齐方式; firstpagetext:第一页按钮上显示的文本; horizontalalign:内容水平对齐方式; lastpagetext:最后页按钮上显示的文本; navigationbuttontype:第一页、下一页、最后一页按钮的类型; nextpagetext:下一页按钮上显示的文本; pageindexboxtype:指示页索引框的显示类型:有TextBOX和dropdownlist两种; pagingbuttonspacing:导航页按钮的间距; prevpagetext:上一页按钮的显示的文本; showcustominfosection:显示当前页和总页信息,默认为不显示,值为LEFT时将显示在页索引前,为right时显示在页索引后; showpageindexbox:指定页索引文本框或下拉框的显示方式; textafterpageindexbox:指定页索引文本框或下拉框后的文本; UrlPaging:是够使用URL传递分页的方式来分页; textbeforepageindexbox:指定页索引文本框或下拉框前面显示的文本; width:该控件的宽度; CustomInfoHTML:指定要显示在用户自定义信息区的用户自定义HTML信息文本 using System; using System.Configuration; using System.Data; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; using System.Data.SqlClient; public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { Bind(); } private void Bind() { int pageindex = 1; int pagenum = AspNetPager1.PageSize; if (Request["page"] != null) { pageindex =Convert.ToInt32(Request["page"]); } DataSet ds = new DataSet(); SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["constr"].ToString ()); SqlConnection con1 = new SqlConnection(ConfigurationManager.ConnectionStrings["constr"].ToString()); SqlDataAdapter sda = new SqlDataAdapter("select top (@pagenum) * from pagetest where id not in (select top (@pagenum*(@pageindex-1)) id from pagetest)", con); sda.SelectCommand.Parameters.AddWithValue("pagenum",pagenum); sda.SelectCommand.Parameters.AddWithValue("pageindex",pageindex); sda.Fill(ds); SqlCommand cmd = new SqlCommand("select count(*) from pagetest", con1); con1.Open(); AspNetPager1.RecordCount =Convert.ToInt32(cmd.ExecuteScalar()); con.Close(); AspNetPager1.CustomInfoHTML = "共" + AspNetPager1.RecordCount + "条记录 " + AspNetPager1.CurrentPageIndex + "/" + AspNetPager1.PageCount; GridView1.DataSource = ds.Tables[0].DefaultView; GridView1.DataBind(); } protected void AspNetPager1_PageChanged(object sender, EventArgs e) { Bind(); } } 深入分析CurrentPageIndex、RecordCount、 PageCount、 PageSize: pagecount: public int PageCount { get { if (this.RecordCount == 0) { return 1; } return (int) Math.Ceiling((double) (((double) this.RecordCount) / ((double) this.PageSize))); } } recordcount: public int RecordCount { get { if (this.cloneFrom != null) { return this.cloneFrom.RecordCount; } object obj2 = this.ViewState["Recordcount"]; if (obj2 != null) { return (int) obj2; } return 0; } set { this.ViewState["Recordcount"] = value; } } CurrentPageIndex: public int CurrentPageIndex { get { if (this.cloneFrom != null) { return this.cloneFrom.CurrentPageIndex; } object obj2 = this.ViewState["CurrentPageIndex"]; int num = (obj2 == null) ? 1 : ((int) obj2); if ((num > this.PageCount) && (this.PageCount > 0)) { return this.PageCount; } if (num < 1) { return 1; } return num; } set { int pageCount = value; if (pageCount < 1) { pageCount = 1; } else if (pageCount > this.PageCount) { pageCount = this.PageCount; } this.ViewState["CurrentPageIndex"] = pageCount; } } PageSize: public int PageSize { get { int num; if ((!string.IsNullOrEmpty(this.UrlPageSizeName) && !base.DesignMode) && (int.TryParse(this.Page.Request.QueryString[this.UrlPageSizeName], out num) && (num > 0))) { return num; } if (this.cloneFrom != null) { return this.cloneFrom.PageSize; } object obj2 = this.ViewState["PageSize"]; if (obj2 != null) { return (int) obj2; } return 10; } set { this.ViewState["PageSize"] = value; } }ASPNETPager常用属性的更多相关文章
- ASPNETPager常用属性(近来用到分页属性)
ASPNETPager常用属性 建议去封装好,然后调用这样比较容易 <webdiyer:aspnetpager id="AspNetPager1" runat="s ...
- AspNetPager常用属性及一些样式(本文摘自网络,作者:x123jing)
AlwaysShow 总是显示分页控件,即使要分页的数据只有一页 AlwaysShowFirsLastPageNumbr 是否总是显示第一页和最后一页数字页索引按钮 BackImageUrl 面板的背 ...
- AspNetPager常用属性及一些样式
AlwaysShow 总是显示分页控件,即使要分页的数据只有一页 AlwaysShowFirsLastPageNumbr 是否总是显示第一页和最后一页数字页索引按钮 BackImageUrl 面板的背 ...
- 【Android自学日记】五大布局常用属性
线性布局(LinearLayout)常用属性: android:orientation="vertical"--决定子类控件的排布方式(vertical垂直:horizontal水 ...
- DataGrid中的常用属性
DataGrid中的常用属性 $('#dg').datagrid({ url:'datagrid_data.json', columns:[[ {field:'code',title:'Code',w ...
- Node.js process 模块常用属性和方法
Node.js是常用的Javascript运行环境,本文和大家发分享的主要是Node.js中process 模块的常用属性和方法,希望通过本文的分享,对大家学习Node.js http://www.m ...
- ImageView的常用属性
ImageView的一些常用属性,并且这些属性都有与之对应的getter.setter方法: android:adjustViewBounds:设置ImageView是否调整自己的边界来保持所显示图片 ...
- HTML a标签、4个伪类、常用属性(下载)、锚链接(待扩展:邮件、电话、短信、GPS)
HTML 超链接<a> 1.超链接可以是一个字.一个词.一组词.一幅图像,您可以点击这些内容来跳转到新的文档或者当前文档中的某个部分. 2.当您把鼠标指针移动到网页中的某个链接上时,箭头会 ...
- iOS导航控制器常用函数与navigationBar常用属性
导航控制器常用函数触发时机 当视图控制器的View将要出现时触发 - (void)viewWillAppear:(BOOL)animated 当视图控制器的View已经出现时触发 - (void)vi ...
随机推荐
- 【iOS】文件上传小记
iOS由该系统提供API可以实现可以实现文件的上传和下载,有两种方法来. NSURLConnection与NSURLSession. 当中NSURLConnection是使用非常久的的一种方式.NSU ...
- POJ 3177 Redundant Paths POJ 3352 Road Construction(双连接)
POJ 3177 Redundant Paths POJ 3352 Road Construction 题目链接 题意:两题一样的.一份代码能交.给定一个连通无向图,问加几条边能使得图变成一个双连通图 ...
- NEON简单介绍
个128位四字寄存器Q0-Q15,32个64位双字寄存器D0-D31,两个寄存器是重叠的,在使用的时候须要特别注意,不小心就会被覆盖掉. NEON的数据类型:无符号整数.有符号整数.未指定类型的整数. ...
- 得到JAVA项目根文件夹
获得的相对路径 说明:相对路径(这并不说明什么时候相对谁)可以通过以下来获得(无论是一般java项目或web工程) String path = System.getProperty("use ...
- 10gocm->session5->数据库管理实验->GC资源管理器的资源消耗组介绍
<GC资源管理器> 官方文件:administrator's Guide->24 Using the Database Resource Manager 用法:在实际生产环境中使用 ...
- 翻译器DIY————次序
突然有一种冲动,想要写一个编译器. 因此,检查在网上搜索相关信息,思想direct3D 有本书叫龙,也有个龙书 Compilers Principles,Techniques, & Tool ...
- MySQL列:innodb的源代码的分析的基础数据结构
在过去的一年中的数据库相关的源代码分析.前段时间分析levelDB实施和BeansDB实现,数据库网络分析这两篇文章非常多.他们也比较深比较分析,所以没有必要重复很多劳力.MYSQL,当然主要还是数据 ...
- <ASP.NET4 从入门到精通>学习笔记1
非常久没有写东西了,今日有时间,開始整理一下关于ASP.NET 4的学习笔记.提醒自己,也欢迎评论. 概述一共分为6个大的部分,兴许文章.将依据每一个部分进行整理,本读书笔记仅仅是整理关键点,对于啰嗦 ...
- HDU 4917 Permutation
意甲冠军: 序列p1.p2.p3--pn由1.2.3--n这些数字 现在给出一些条件pi<pj 部条件的排列的个数 思路: 非常easy想到用一条有向的线连接全部的pi和pj 那么就构成了 ...
- 数据结构(C达到)------- 双链表
双链表中的每个节点包含两个指针域,指针域包含其后继节点的内存地址,还有一个指针所存储的存储器地址其领域前驱节点. 双向链表结点的类型描写叙述: //双向链表的类型描写叙述 typedef int El ...