国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開APP
userphoto
未登錄

開通VIP,暢享免費電子書等14項超值服

開通VIP
asp.net jquery 實現(xiàn)分頁
Asp.Net無刷新分頁( jquery.pagination.js)

采用Jquery無刷新分頁插件jquery.pagination.js 實現(xiàn)無刷新分頁效果

友情提示:本示例Handler中采用StringBuilder的append方法追加HTML,小數(shù)據(jù)量可以,但是大數(shù)據(jù)或是布局常變,建議返回JSON格式的數(shù)據(jù),性能和靈活性更好!

1.插件參數(shù)列表

2.頁面內(nèi)容:

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Porschev----無刷新翻頁</title>
<script src="Script/jquery-1.4.1.min.js" type="text/javascript"></script>
<script src="Script/jquery.pagination.js" type="text/javascript"></script>
<script src="Script/tablecloth.js" type="text/javascript"></script>
<link href="Style/tablecloth.css" rel="stylesheet" type="text/css"/>
<link href="Style/pagination.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript">

var pageIndex =0; //頁面索引初始值
var pageSize =10; //每頁顯示條數(shù)初始化,修改顯示條數(shù),修改這里即可


$(
function() {
InitTable(
0); //Load事件,初始化表格數(shù)據(jù),頁面索引為0(第一頁)

//分頁,PageCount是總條目數(shù),這是必選參數(shù),其它參數(shù)都是可選
$("#Pagination").pagination(<%=pageCount %>, {
callback: PageCallback,
prev_text:
'上一頁', //上一頁按鈕里text
next_text: '下一頁', //下一頁按鈕里text
items_per_page: pageSize, //顯示條數(shù)
num_display_entries: 6, //連續(xù)分頁主體部分分頁條目數(shù)
current_page: pageIndex, //當(dāng)前頁索引
num_edge_entries: 2//兩側(cè)首尾分頁條目數(shù)
});

//翻頁調(diào)用
function PageCallback(index, jq) {
InitTable(index);
}
//請求數(shù)據(jù)
function InitTable(pageIndex) {
$.ajax({
type:
"POST",
dataType:
"text",
url:
'Handler/PagerHandler.ashx', //提交到一般處理程序請求數(shù)據(jù)
data: "pageIndex="+ (pageIndex +1) +"&pageSize="+ pageSize, //提交兩個參數(shù):pageIndex(頁面索引),pageSize(顯示條數(shù))
success: function(data) {
$(
"#Result tr:gt(0)").remove(); //移除Id為Result的表格里的行,從第二行開始(這里根據(jù)頁面布局不同頁變)
$("#Result").append(data); //將返回的數(shù)據(jù)追加到表格
}
});
}

});

</script>
</head>
<body>
<div align="center">
<h1>Posrchev----無刷新分頁</h1>
</div>
<div id="container">
<table id="Result" cellspacing="0" cellpadding="0">
<tr>
<th>編號</th>
<th>名稱</th>
</tr>
</table>
<div id="Pagination"></div>
</div>
</body>
</html>

3.頁面.cs文件內(nèi)容:

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; //總條目數(shù)
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
pageCount = new PagerTestBLL.PersonManager().GetPersonCount().ToString();
}
}
}



4.Handler中的內(nèi)容:

<%@ 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;

//具體的頁面數(shù)
int pageIndex;
int.TryParse(context.Request["pageIndex"], out pageIndex);
//頁面顯示條數(shù)
int size = Convert.ToInt32(context.Request["pageSize"]);

if (pageIndex == 0)
{
pageIndex = 1;
}

int count;
List<PagerTestModels.Person> list = new PagerTestBLL.PersonManager().GetAllPerson(size, pageIndex, "", out count);

StringBuilder sb = new StringBuilder();
foreach (PagerTestModels.Person p in list)
{
sb.Append("<tr><td>");
sb.Append(p.Id.ToString());
sb.Append("</td><td>");
sb.Append(p.Name);
sb.Append("</td></tr>");
}
str = sb.ToString();
context.Response.Write(str);
}

public bool IsReusable {
get {
return false;
}
}
}

5.實現(xiàn)效果圖:

6.源碼下載地址一:http://download.csdn.net/source/2959451

下載地址二:http://files.cnblogs.com/zhongweiv/Pager.rar

示例分頁存儲過程下載:http://files.cnblogs.com/zhongweiv/PROC_Paging.zip

本站僅提供存儲服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊舉報
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
web數(shù)據(jù)綁定控件之分頁的兩個方法
有了jsRender,媽媽再也不用擔(dān)心我用jq拼接DOM拼接的一團糟了、頁面整齊了、其他伙伴讀代碼也不那么費勁了
SQL server 分頁方法小結(jié)
jquery+css3打造一款ajax分頁插件
jquery.pagination JSON 動態(tài)無刷新分頁
ASP.NET MVC分頁的實現(xiàn)方法
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長圖 關(guān)注 下載文章
綁定賬號成功
后續(xù)可登錄賬號暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點擊這里聯(lián)系客服!

聯(lián)系客服