zoukankan      html  css  js  c++  java
  • 添加分页

    <div style="text-align: center; padding-top: 10px">
                                <webdiyer:AspNetPager ID="AspNetPager1" runat="server" PageSize="20" FirstPageText="首页"
                                    CssClass="anpager" LastPageText="尾页" NextPageText="下一页" PageIndexBoxType="DropDownList"
                                    PrevPageText="上一页" ShowPageIndexBox="Always" SubmitButtonText="Go" TextAfterPageIndexBox=""
                                    TextBeforePageIndexBox="转到" AlwaysShow="True" CustomInfoHTML="共%PageCount%页,当前为第%CurrentPageIndex%页"
                                    OnPageChanged="AspNetPager1_PageChanged" ShowCustomInfoSection="Right">
                                </webdiyer:AspNetPager>
                            </div>

    后台:

    using System;
    using System.Collections;
    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.Web.Services;
    
    public partial class AJAX_GetMsg : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                BoundUserJH();
            }
        }
        private void BoundUserJH()
        {
            string strwhere = GetWhere();
    
            AspNetPager1.RecordCount = int.Parse(rsc.ExecuteSQLThree("select count(1) from rsgl_renwu " + strwhere).ToString());
            SoftDown.DataSource = Wps.Common.Util.CDataSet(rsc.ExecuteSQLTwo("select * from (SELECT ROW_NUMBER() OVER (order by rw_id)AS Row,rw_ID,rw_kahao,rw_shuliang,rw_zhiwu,rw_datatime from rsgl_renwu " + strwhere + ") TT where TT.Row between " + AspNetPager1.StartRecordIndex + " and " + AspNetPager1.EndRecordIndex, "GetMianshiliang"));
            SoftDown.DataBind();
        }
        protected void AspNetPager1_PageChanged(object src, EventArgs e)
        {
            BoundUserJH();
        } 
    }

    注意sql语句

    select * from (SELECT ROW_NUMBER() OVER (order by rw_id)AS Row,rw_ID from rsgl_renwu " + strwhere + ") TT where TT.Row between " + AspNetPager1.StartRecordIndex + " and " + AspNetPager1.EndRecordIndex, "GetMianshiliang")
  • 相关阅读:
    HttpMessageNotWritableException: Could not write JSON: No serializer found for class ****
    在线测试且生成文档
    jenkins和gitlab结合的时候出错
    Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 2611816 bytes)
    webpack初入
    破网速测试
    SQLDumpSplitter sql文件分割工具
    FTP连接服务器总报错的问题解决
    nw.js---创建一个点击菜单
    nw.js---开发一个百度浏览器
  • 原文地址:https://www.cnblogs.com/tianrui/p/3393929.html
Copyright © 2011-2022 走看看