asp.net jquery无刷新分页插件(jquery.pagination.js)

采用Jquery无刷新分页插件jquery.pagination.js 实现无刷新分页效果
友情提示:本示例Handler中采用StringBuilder的append方法追加HTML,小数据量可以,但是大数据或是布局常变,建议返回JSON格式的数据,性能和灵活性更好!

1.插件参数列表

asp.net jquery无刷新分页插件(jquery.pagination.js)_第1张图片 
2.页面内容

复制代码 代码如下:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default"%>



Porschev----无刷新翻页









Posrchev----无刷新分页









编号 名称






3.页面.cs文件内容
复制代码 代码如下:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class _Default : System.Web.UI.Page
{
public string pageCount = string.Empty; //总条目数
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
pageCount = new PagerTestBLL.PersonManager().GetPersonCount().ToString();
}
}
}

4.Handler中的内容
复制代码 代码如下:

<%@ WebHandler Language="C#" Class="PagerHandler" %>
using System;
using System.Web;
using System.Collections.Generic;
using System.Text;
public class PagerHandler : IHttpHandler {
public void ProcessRequest (HttpContext context) {
context.Response.ContentType = "text/plain";
string str = string.Empty;
//具体的页面数
int pageIndex;
int.TryParse(context.Request["pageIndex"], out pageIndex);
//页面显示条数
int size = Convert.ToInt32(context.Request["pageSize"]);
if (pageIndex == 0)
{
pageIndex = 1;
}
int count;
List list = new PagerTestBLL.PersonManager().GetAllPerson(size, pageIndex, "", out count);
StringBuilder sb = new StringBuilder();
foreach (PagerTestModels.Person p in list)
{
sb.Append("");
sb.Append(p.Id.ToString());
sb.Append("");
sb.Append(p.Name);
sb.Append("");
}
str = sb.ToString();
context.Response.Write(str);
}
public bool IsReusable {
get {
return false;
}
}
}

5.实现效果图

asp.net jquery无刷新分页插件(jquery.pagination.js)_第2张图片


源码下载

你可能感兴趣的:(asp.net jquery无刷新分页插件(jquery.pagination.js))