ASP.NET MVC Webgrid Efficient Paging
问题 I have a ASP.NET MVC 4 project and a SQL View (vvItem). ItemController MVCAppEntities db = new MVCAppEntities(); public ActionResult Index() { var itemqry = db.vvItem.OrderBy(s => s.name); //var pageditems = itemqry.Skip(10).Take(20); // 25 seconds return View(itemqry.ToList()); // 88 seconds } Index.cshtml View @model IEnumerable<MVCApplication1.Models.vvItem> @{ var norows = 20; var grid = new WebGrid(Model, canPage: true, rowsPerPage: norows); grid.Pager(WebGridPagerModes.NextPrevious);