Kkpager implements ajax paging query and kkpagerajax

Source: Internet
Author: User

Kkpager implements ajax paging query and kkpagerajax

Front-end paging data, suitable for a small amount of data, because the paging data is obtained from the back-end, big data is not recommended

 

The front-end code is as follows:

@ {Layout = null ;}<! DOCTYPE html> 

 

Background code:

Using System; using System. collections. generic; using System. linq; using System. text; using System. web; using System. web. mvc; namespace MvcKKpager. controllers {public class HomeController: Controller {private readonly int pageSize = 2; // GET:/Home/public ActionResult Index () {return View ();} public ActionResult Index2 (string pageIndex) {List <String> list = new List <String> (); list. add ("Protect the Environment"); list. add ("Protect the Environment"); list. add ("Protect the Environment"); list. add ("Protect the Environment"); list. add ("Protect the Environment"); var persons = (from p in list select p ). skip (int. parse (pageIndex)-1) * pageSize ). take (pageSize); StringBuilder builder = new StringBuilder (); builder. append ("<table class = \" table-striped B-t B-light text-sm \ "id = \" comptable \ ">"); builder. append ("<thead> <tr> <th> time </th> <th> display </th> <th> click (click rate) </th> <th> activation (activation) </th> <th> average unit price </th> <th> actual activation cost </th> <th> consumption </th> </tr> </thead> "); builder. append ("<tbody>"); foreach (var item in persons) {builder. append ("<tr class = \" trStyle \ ">"); builder. append ("<td>" + item + "</td>"); builder. append ("<td>" + item + "</td>"); builder. append ("<td>" + item + "</td>"); builder. append ("<td>" + item + "</td>"); builder. append ("<td>" + item + "</td>"); builder. append ("<td>" + item + "</td>"); builder. append ("<td>" + item + "</td>"); builder. append ("</tr>");} builder. append ("</tbody> </table>"); var result = new {status = "1", data = builder. toString (), pagecount = list. count (). toString (), pagesize = pageSize. toString ()}; return Json (result );}}}

 

 

Nothing to say

Check the style.

 

Download link: http://pan.baidu.com/s/1dEJqXzF

 

Related Article

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.