当前位置: 代码迷 >> ASP.NET >> google的分页解决方案
  详细解决方案

google的分页解决方案

热度:3538   发布时间:2013-02-25 00:00:00.0
google的分页
C# code
  PagedDataSource pds = new PagedDataSource(); //创建分页对象            pds.DataSource = ds.Tables[0].DefaultView; //绑定分页数据            pds.AllowPaging = true; //开启分页            int pagerowsize = pagesize;//每页显示几行            int datarocount = this.ds.Tables[0].Rows.Count; // 数据集中共有多少行            int totalpage = pds.PageCount;//总页数            int pagedqindex = pds.CurrentPageIndex;//当前页索引            int pagepor = pagedqindex - 1;//上一页            int pageext = pagedqindex + 1;//下一页            int strat = 0;                       if (Request.QueryString["page"] != null) //判断请求页面的参数是否为空,为空则表示当前还没分过页            {                pds.CurrentPageIndex = Convert.ToInt32(Request.QueryString["page"]) - 1;                //具体的数字分页逻辑??怎么写,类似google的那个            }            else            {                    end = 10;            }            for (int i = strat+1; i <=end; i++)            {             this.kje_con_fylb.InnerHtml += "<span class=\"kje_con_fyin\"><a href=\"" + HttpContext.Current.Request.CurrentExecutionFilePath + "?page=" + i + "\">" + i + "</a> </span>";            }            kje_con_fylb.InnerHtml += "<span class=\"kje_con_fyin\">共" + totalpage + "页</span>";                    this.DataList1.DataSource = pds;            this.DataList1.DataBind();


------解决方案--------------------------------------------------------
建议楼主试试AspNetPager:http://www.webdiyer.com/controls/aspnetpager
  相关解决方案