1. Use the plug-in jquery.pagination.js. If you don’t have this js file, I can send it to you.
First quote jquery.pagination.js (pagination js), followed by pagination.css (pagination style css).
2. The page js code is
3. Page< body>The code inside is
Product number |
Product name |
4. The page background code is
protected int pcount = 0; //Total number of items
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
BLL.TbGoods bll = new BLL.TbGoods();
pcount = bll.GetRecordCount("Status='" (int)Enum. RecordStatus.Normal "'"); //Get the total number of pages, that is, the total number of data to be realized. If you don't understand yet, just select count (*) from Table, which is the number here.
}
}
5. The general handler fffff.ashx code is
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Text;
using System.Data;
namespace EShop.Web.Admin.tool.Reserver
{
///
/// ListBuyBatchManage 的摘要说明
///
public class ListBuyBatchManage : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
String str = string.Empty;
if (context.Request["pageIndex"] != null && context.Request["pageIndex"].ToString().Length > 0)
{
int pageIndex; //具体的页面数
int.TryParse(context.Request["pageIndex"], out pageIndex);
if(context.Request["pageSize"]!=null&&context.Request["pageSize"].ToString().Length > 0)
{
//页面显示条数
int size = Convert.ToInt32(context.Request["pageSize"]);
string data= BindSource(size,pageIndex);
context.Response.Write(data);
context.Response.End();
}
}
}
#region 无刷新分页
public string BindSource(int pagesize,int page)
{
BLL.TbGoods bll=new BLL.TbGoods();
DataSet ds = bll.GetListByPage("Status='" (int)Enum.RecordStatus.Normal "'", "", pagesize * page 1, pagesize * (page 1)); //获取数据源的ds会吧。
StringBuilder sb = new StringBuilder();
if (ds!=null)
{
foreach (DataRow row in ds.Tables[0].Rows)
{
sb.Append("
"); sb.Append(row["GoodsUid"]); sb.Append(" | "); sb.Append(row["GoodsName"]); sb.Append(" |
");
}
}
return sb.ToString();
}
#endregion
public bool IsReusable
{
get
{
return false;
}
}
}
}
6.效果图
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn