No Refresh paging jquery.pagination.js
1. Use the plug-in as Jquery.pagination.js, if there is no this JS file, I can send a.
First of all refer to Jquery.pagination.js (page js), with PAGINATION.CSS (page style CSS).
Click Get to view these two files
2. The page JS code is
<script type="Text/javascript">var pageIndex =0;//Page Index Initial valuevar pageSize =15;//Show number of bars per page initialization, modify the number of display, modify here can$ (function () {Inittable (0);//Load event, initialization of tabular data, page index 0 (first page)//Paging, PageCount is the total number of entries, which is a required parameter, and other parameters are optional $ ("#Pagination"). Pagination (<%=pcount%>, {callback:pagecallback,//Pagecallback () calls the secondary function for page flipping. Prev_text:"«Previous Page", Next_text:"Next Page»", Items_per_page:pagesize,Num_edge_entries:2,//Number of page entries on both sides Num_display_entries:6,//The number of page entries in the main part of a continuous paging current_page:pageindex,//Current page Index});//Page Callfunction Pagecallback (index, JQ) {inittable (index);}//Request datafunction Inittable (pageIndex) {$.ajax ({type:"POST", DataType:"Text"Url:‘Http://www.cnblogs.com/tool/Reserver/ManageBuyBatchManage.ashx‘,//Submit to generic handler request data:"pageindex= "&pagesize=" + PageSize, // submit two parameters: PageIndex (page index), pageSize (display number of bars) Span style= "color: #000000;" > Success:function (data) {$ ( " #Result tr:gt (0) // Remove the row from the table with the ID result, starting with the second line (this changes depending on the page layout) $ ( " #Result "). Append (data); //}}); } }); </script>
3. Page <body> the code inside is
<table width="100%"Border="0"Cellspacing="0"Cellpadding="0"> <tr> <td width="60"Align="Right"> Product name:</td> <td width="200"Align="Left"><input type="Text"Id="Txtkeywords"class="Keyword"/></td> <td width="200"Align="Left"><input id="Search"Type="button"Value="Find"class= "submit"/></td > <td > </td> </tr> </table> <table id= "result "Cellspacing=" 0" 0 "pagination "class=" right Flickr
4. The page background code is
Protectedint pcount =0;//protected void page _load (object sender, EventArgs e) {if (! IsPostBack) {BLL. Tbgoods BLL = new BLL. Tbgoods (); Pcount = BLL. GetRecordCount ( "status=" "+ ( " "); // Get the total number of pages, that is, the total number of data to be realistic, the only thing that is not understood is select COUNT (*) from Table, that's the number here. /span>
5. The general handler Fffff.ashx code is
UsingSystem;UsingSystem.Collections.Generic;UsingSystem.Linq;Usingsystem.web;UsingSystem.Text;UsingSystem.Data;Namespaceeshop.web.admin.tool.reserver{///<summary>///Summary description of Listbuybatchmanage///</summary>PublicClassListbuybatchmanage:ihttphandler {PublicvoidProcessRequest (HttpContext context) {context. Response.ContentType ="Text/plain"; String str =String. Empty;if (context. request["PageIndex"] !=Null && context. request["PageIndex"]. ToString (). Length >0) {int pageIndex;//Number of specific pagesInt. TryParse (context. request["PageIndex"],OutPageIndex);if (context. request["PageSize"]!=Null&&context. request["PageSize"]. ToString (). Length >0) {//Page display number of barsint size = Convert.ToInt32 (context. request["PageSize"]);String data=Bindsource (Size,pageindex); Context. Response.Write (data); Context. Response.End (); } } }#region No Refresh PagingPublicString Bindsource (int pagesize,IntPage) {BLL. Tbgoods bll=NewBll. Tbgoods (); DataSet ds = BLL. Getlistbypage ("Status= '" + (int) Enum.RecordStatus.Normal +"‘","", pagesize * page +1, pagesize * (page +1));//Get the DS of the data source. StringBuilder SB =NewStringBuilder ();if (ds!=Null) {foreach (DataRow rowIn DS. tables[0]. Rows) {sb. Append ("<tr><td>"); Sb. Append (row["Goodsuid"]); Sb. Append ("</td><td> " ); Sb. Append (Row[ "goodsname " "</td></tr> ");}} return SB. ToString (); } #endregion public IsReusable {getreturn false
6.
Reproduced in original: http://www.cnblogs.com/knowledgesea/archive/2012/05/19/2508924.html
No Refresh paging jquery.pagination.js