Look at the introduction
Http://datatables.club/manual/server-side.html
No processed pagination, first shown to see the effect, so write (the stored procedure to write itself)
cshtml
"ServerSide"true,"Processing"true, //Whether to show the processing status (when sorting, the data is much time consuming, it will also show this)
Controller.cs
//Jquery.datatables PublicJsonresult getuserinfolist () {Try { intPageSize =int. Parse (request.params["length"]); intStart =int. Parse (request.params["Start"]); intPageIndex = Start/pagesize +1; Jsonresponse List=UserInfoService.Service.GetDataTablesUserInfoList (PageIndex, pageSize); return This. Json (list); } Catch(Exception ex) {return This. Json (Unifyresponse.throwerror (ex)); } }
Bll
PublicJsonresponse Getdatatablesuserinfolist (intPageIndex,intpageSize) { Try{proc_datapagination P_page=Newproc_datapagination (); P_page. Table="UserInfo"; P_page. fields="*"; P_page. CurrentPage=PageIndex; P_page. PageSize=pageSize; P_page. by="ID desc"; P_page. Where=string. Format ("1=1"); //P_page. Where = string. Format ("OpenID like '%{0}% '",);ilist<userinfo> list = ddatabase.webdb.storedproceduretoilist<proc_datapagination, UserInfo>(P_page); Jsonresponse MyPage=NewJsonresponse (); Mypage.data=list; Mypage.recordstotal=P_page. Count; Mypage.recordsfiltered=P_page. Count; returnMyPage; } Catch(Exception ex) {Throwex; } }
Jquery.datatables Server processing (server-side processing)