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 ...
随机推荐
- zoj3829 Known Notation --- 2014 ACM-ICPC Asia Mudanjiang Regional Contest
根据规则,可以发现,一*之前必须有至少2数字.一(11*)这反过来可以被视为一数字. 因此,总位数必须大于*号码,或者你会加入数字. 添加数字后,,为了确保该解决方案将能够获得通过交流.那么肯定是*放 ...
- STM32本学习笔记EXTI(外部中断)
参考资料:STM32数据表.网络信息 =========================================切割线===================================== ...
- 2014百度之星资格赛——Disk Schedule
2014百度拥有明星格比赛--Disk Schedule Problem Description 有非常多从磁盘读取数据的需求,包含顺序读取.随机读取. 为了提高效率.须要人为安排磁盘读取. 然而.在 ...
- net搭建热插拔式web框架
net搭建热插拔式web框架(重造Controller) 由于.net MVC 的controller 依赖于HttpContext,而我们在上一篇中的沙箱模式已经把一次http请求转换为反射调用,并 ...
- C标签之forEach
<c:forEach>标签用于通用数据循环,它有下面属性 属 性 描 述 是否必须 缺省值 items 进行循环的项目 否 无 begin 開始条件 否 0 end 结束条件 否 集合中的 ...
- android--jenkins+gradle+android自动化构建apk步骤(转)
第一步,安装jenkins,这个网上教程挺多的. 第二步,下载并配置gradle.下载地址http://www.gradle.org/ 解压gradle至某路径下,如/usr/local/lib/gr ...
- 50一个Android开发技巧(01 利用好layout_weight属性)
问题:如何将一个Button放置在布局的中间,并设置其宽度parent的50%? 分析:问题想要达到的效果应该是这样: (原文地址:http://blog.csdn.net/vector_yi/art ...
- MVC5个人用户账户身份验证集成google和facebook的OAuth2登陆
最终效果 官方文档:MVC 5 App with Facebook, Twitter, LinkedIn and Google OAuth2 Sign-on 内容简介:上面传送门的博客中讲解了如何在M ...
- T-SQL技巧收集——拆分字符串
原文:T-SQL技巧收集--拆分字符串 在开发中,很多时候都需要处理拆分字符串的操作.下面收集了几种方法供大家分享,其中的逗号可以改为多种有需要的符号,但是不能针对多种符号同时存在的例子.有待各位补充 ...
- onethink和phpwind共享
将onethink和phpwind数据库安装在一起.使用公用表前缀. 将onethink的member表点phpwind有user表 这是onethink在根文件夹的安装,phpwind安装在bbs的 ...