jquery Paging plugin jquery.pagination.js implementation No refresh paging _jquery

Source: Internet
Author: User
Tags int size

This example for you to share the jquery paging plug-in implementation of the relevant code without refreshing pagination for your reference, the specific contents are as follows

1. Use Plug-ins for jquery.pagination.js, if not this JS file, I can send a.

First refer to Jquery.pagination.js (paging JS), with pagination.css (pagination style CSS).

Click Get to view these two files

2. Page JS code for

<script type= "Text/javascript" > var pageIndex = 0;  Page index initial value var pageSize = 15; Each page shows the number of bar initialization, modify the number of display bar, modify this can be $ (function () {inittable (0);//load event, initialization table data, page index 0 (first page)//paging, PageCount is total number of entries, this is a required parameter
      Number, the other parameters are optional $ ("#Pagination"). Pagination (<%=pcount%> {callback:pagecallback,//pagecallback () calls the secondary function for paging.
      Prev_text: "«Previous Page", Next_text: "Next Page»", Items_per_page:pagesize, Num_edge_entries:2,///Both ends page entry number
    Num_display_entries:6,////////////////////page Current_page:pageindex,//Current page index}); 
    Page Call Function Pagecallback (index, JQ) {inittable (index); 
      }//Request data Function inittable (pageIndex) {$.ajax ({type: POST), DataType: "Text", URL: ' http://www.cnblogs.com/tool/Reserver/ManageBuyBatchManage.ashx ',//submit to General handler request data: "pageindex=" + ( PageIndex) + "&pagesize=" + pageSize,//Submit two parameters: PageIndex (page index), pageSize (display number) success:function (data) {
       $ ("#Result tr:gt (0)"). Remove ();    Removes the row in the table with the ID result, starting at the second row (where different pages are changed according to the page layout) $ ("#Result"). Append (data); 
    Append the returned data to the table}}); 


3. Page <body> inside the code is

 <table width= "100%" border= "0" cellspacing= "0" cellpadding= "0" >
    <td width= "align=" Right "> Product name:</td>
    <td width=" "align=" left "><input type=" text "id=" Txtkeywords "class=" Keyword "/></td>
    <td width=" align= "left" ><input "search" id= "button" type= "Find" class = "Submit"/></td>
    <td > </td>
  <table id= "result "cellspacing=" 0 "cellpadding=" 0 ">   
     <th> Product number </th>
     <th> product name </th >
  <div id= "pagination" class= "right Flickr" ></div>

4. Page background code is

  protected int pcount = 0;   Total number of
  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 realistic, it is not clear that the select count (*) from Table, is the number here.

5. 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 {///<summary>///listbuybatchmanage Summary description///</summary> 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;//specific number of pages int. TryParse (context.
    request["PageIndex"], out pageIndex); if (context. request["PageSize"]!=null&&context. request["PageSize"]. ToString (). Length > 0) {//page display number int size = Convert.ToInt32 (context.
    String Data= bindsource (Size,pageindex); Context.
    Response.Write (data); Context.
    Response.End (); #region No Refresh Paging 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));
   Get the DS for the data source.
   StringBuilder sb = new StringBuilder (); if (ds!=null) {foreach (DataRow row in DS). Tables[0]. Rows) {sb.
     Append ("<tr><td>"); Sb.
     Append (row["Goodsuid"]); Sb.
     Append ("</td><td>"); Sb.
     Append (row["Goodsname"]); Sb.
    Append ("</td></tr>"); } return SB.
  ToString ();
   #endregion public bool IsReusable {get {return false;


6. Effect Drawing

The above is the entire content of this article, I hope to help you learn.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.