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 ...
随机推荐
- Gas Station [leetcode] 两个解决方案
因为gas的总数大于cost总时间.你将能够圈住整个城市. 第一溶液: 如果一開始有足够的油.从位置i出发.到位置k时剩余的油量为L(i,k). 对随意的k.L(i,k)依据i的不同,仅仅相差常数. ...
- UVA 11769 All Souls Night 的三维凸包要求的表面面积
主题链接:option=com_onlinejudge&Itemid=8&page=show_problem&problem=2869">点击打开链接 求给定的 ...
- HDU 1815, POJ 2749 Building roads(2-sat)
HDU 1815, POJ 2749 Building roads pid=1815" target="_blank" style="">题目链 ...
- SimpleDateFormat使用特定的解释
public class SimpleDateFormat extends DateFormat SimpleDateFormat 是一个以国别敏感的方式格式化和分析数据的详细类. 它同意格式化 ...
- HDU 1085-Holding Bin-Laden Captive!(生成功能)
Holding Bin-Laden Captive! Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Ja ...
- 科技股晴间多云 阿里京东IPO或受影响
微博的时间长达一个月的时间才上市.科技股一直笼罩. Facebook一个月股价下跌21.55%:特斯拉跌幅21.69%:亚马逊的股价相比,1一个月27日高点下跌22.13%. 以前的明星股票都已进入华 ...
- JAVA Socket传输Object(对象)注意的问题
在java中,可以通过socket将一个对象进行传递,通过ObjectOutputStream,ObjectInputStream来进行写入和读取(具体的方法参考http://blog.csdn.ne ...
- STM32 水晶不摇
刚刚得到一个新的董事会,该设备被编程为去,但执行地址不正确,没有进入c语言 没有进入c语言,有可能是一个难以回答的问题狗,硬狗拆除 检查以下四种情况 1.检查片内的功率是所有权利 2.检查晶体线短路 ...
- 第十二章——SQLServer统计信息(2)——非索引键上统计信息的影响
原文:第十二章--SQLServer统计信息(2)--非索引键上统计信息的影响 前言: 索引对性能方面总是扮演着一个重要的角色,实际上,查询优化器首先检查谓词上的统计信息,然后才决定用什么索引.一般情 ...
- RH253读书笔记(1)-Lab 1 System Monitoring
Lab 1 System Monitoring Goal: To build skills to better assess system resources, performance and sec ...