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")
  • 相关阅读:
    即时搜索(input框)
    HTML的页面IE注释
    浅谈attr()和prop()
    input---checked小问题
    鼠标右键事件
    JavaScript 异步开发全攻略(转)
    remove方法
    javascript 数组以及对象的深拷贝(复制数组或复制对象)的方法
    Hexo的更新 主题的更换
    深浅拷贝,原生和JQuery方法实现
  • 原文地址:https://www.cnblogs.com/tianrui/p/3393929.html
Copyright © 2011-2022 走看看