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")
  • 相关阅读:
    C++常变量
    C++变量(C++变量定义、变量赋值、命名规则)
    463. Island Perimeter
    500. Keyboard Row
    811. Subdomain Visit Count
    901. Online Stock Span
    419. Battleships in a Board
    620. Not Boring Movies
    893. Groups of Special-Equivalent Strings
    575. Distribute Candies
  • 原文地址:https://www.cnblogs.com/tianrui/p/3393929.html
Copyright © 2011-2022 走看看