标签:page contain each row public code 分页 var class
当前页:<span id="currentPage"></span> 总页数:<span id="totalPage"></span> 总条数:<span id="totalCount"></span> <input id="Button1" type="button" value="首页" onclick="ShowList(1)" /> <input id="Button1" type="button" value="上一页" onclick="ShowList(currentPage-1)" /> <input id="Button1" type="button" value="下一页" onclick="ShowList(currentPage+1)" /> <input id="Button1" type="button" value="尾页" onclick="ShowList(totalPage)" />
public PageModel Get(string YName, int pageSize = 1, int currentPage = 1) { var list = bll.ShowRowe(YName); if (currentPage < 1) { currentPage = 1; } if (!string.IsNullOrEmpty(YName)) { list = list.Where(s => s.YName.Contains(YName)).ToList(); } int count = list.Count(); int page; if (count % pageSize == 0) { page = count / pageSize; } else { page = count / pageSize + 1; } if (currentPage > page) { currentPage = page; } var p = new PageModel(); p.currentPage = currentPage; p.totalCount = count; p.totalPage = page; p.RoweModel = list.Skip((currentPage - 1) * pageSize).Take(pageSize).ToList(); return p; }
var currentPage = 1; var totalPage = 1; $(function () { ShowList(1); }); function ShowList(page) { var obj = {}; obj.YName = $("#YName").val(); obj.currentPage = page; obj.pageSize = 1; $.ajax({ url: , data: , type: ‘‘, dataType: ‘‘, success: function (data) { currentPage = data.currentPage; totalPage = data.totalPage; $("#currentPage").text(data.currentPage); $("#totalPage").text(data.totalPage); $("#totalCount").text(data.totalCount); $("#tb").empty(); $(data.RoweModel).each(function () {
标签:page contain each row public code 分页 var class
原文地址:https://www.cnblogs.com/ntg2/p/13276992.html