En mi trabajo anterior, usé mucha paginación, pero no ha sido sólida, por lo que no es fácil de usar. Esta es una paginación con actualización parcial. Intenté mucho. Quería usar MVCPager para una actualización parcial, pero teniendo en cuenta que el costo es demasiado alto, me di por vencido. Resumamos primero la paginación basada en bootstrap, para que pueda ser conveniente para mí usar en el futuro
Dirección de código abierto https://github.com/lyonlai/bootstrap-paginator
Cita primero
JQuery
bootstrap.min.js
Bootstrap-Paginator.min.js
Código de controlador
[AuthorizationCodeAttribute] [Descripción ("Información de comentarios")] [httppost] Public ActionResult Comment (int id, int? Page) {#Lista de comentarios de la región var dal = new CarcommentOperator (); int pageindex = página ?? 1; // Página actual if (! String.isNullorEmpty (request.queryRytring ["PageIndex"])) {if (! Int.tryParse (request.queryString ["PageIndex"], Out PageIndex)) {PageIndex = 1;}} Const int Pagesize = 2; Long TotalCount; Long TotalPageCount; IEnumerable <Carcomment> list = dal.getList (PageIndex, PageSize, Out TotalPageCount, Out TotalCount, "CarID =" + id); var commentipagedList = new staticPagedList <Carcomment> (List, PageIndex, PageSize, Convert.Toint32 (total TotalCount));#Endregion // convertir a JSON Format Varat "{/" pageCount/":" + commentipagedList.pageCount + ",/" currentPage/":" + commentipagedList.pageNumber + ",/" list/":" + jsonConvert.SerializeObject (list) + "}"; return json (strResult, jsonRequestBehavior.Anlowget);}código JS
<script type = "text/javaScript"> $ (documento) .Ready (function () {var carid = 1; $. Ajax ({url: "/car/comment", dataType: 'json', type: "post", data: "id =" + carid, suctar: function (data) {if (data! = null) {$ .each (eval ("(" + "). {// TransTraight el JSON devuelto $ ("#list"). append ('<table>'); $ ("#list"). append ('<tr>'); $ ("#list"). append ('<td> comentarista </td>'); $ ("#list"). append ('<td>'+item.userProfileid+'<1/td>); $ ("#list"). Append (' '</TR> </TR> '); $ ("#list"). append (' <tr> '); $ ("#list"). append (' <td> content </td> '); $ ("#list"). append (' <td> '+item.content+' </td> '); $ ("#list"). append (' </tr>); $ ("#list"). }); // eval ("(" + data + ")"). currentPage; // vaya a las opciones de datos de datos json devueltos = {bootstraPMaJorverSion: 3, // Versione currentPage: currutionPage, // actual de página "Primero": return "HomePage"; caso "anterior": return "página anterior"; caso "siguiente": return "siguiente página"; caso "Último": return "Última página"; caso "página": return Page;} //} // pageUrl: function (type, página, actual) {// return "/car/detalles page =" + página;}, // Evento en el evento OnpageClicked: function (Function (Events, type, Type, Page? $ .AJAX ({url: "/car/comment? Id =" + carid, type: "post", data: "page =" + page, success: function (data1) {if (data1! = null) {$ ("#list"). html ("" "); $. cada (eval (" (" + data1 +") "). Lista, función (índice) {// transferir la transferencia de Json. $ (" #list"). append ('<table style = "borde: 1px sólido #00ced1; ancho: 300px "> '); $ ("#list "). Append (' <tr> '); $ ("#list "). Append (' <td> comentarista </td> '); $ ("#list "). Append (' <td> '+item.userProfileID+' </td> '); $ ("#list "). Append (' </tr> '); $ ("#list"). append ('<tr>'); $ ("#list"). append ('<td>'); $ ("#list"). append ('<td>'+item.content+'</td>'); $ ("#list"). append ('</tr>'); $ ("#list"). append (</table> ''); });}}});}}; element.bootstrappaginator (opciones);}}});});Lo anterior es la actualización de la página basada en Bootstrap presentada por el editor para usted. Espero que te sea útil. Si tiene alguna pregunta, déjame un mensaje y el editor le responderá a tiempo. ¡Muchas gracias por su apoyo al sitio web de Wulin.com!