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