• 添加分页


    <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")
  • 相关阅读:
    天才难过四级关
    肉鸟一只
    继续折腾mac。os(没进展)
    Intel(R) ICH9M LPC Interface Controller 2919驱动安装方法
    nusoap的使用
    STL HASH_MAP简单应用
    jQuery select操作控制方法小结
    unordered_map详解
    STL map与Boost unordered_map
    [C/C++]关于C++11中的std::move和std::forward
  • 原文地址:https://www.cnblogs.com/tianrui/p/3393929.html
Copyright © 2020-2023  润新知