Using EF, previously my action method was -
public ActionResult Index(int? page)
{
return View(db.TestUploadData2.ToList().ToPagedList(page ?? 1, 100));
}
But problem is that .ToList() pulls everything from DB into C# memory and then getting required 100 records which increases execution time & memory consumption.
Using following code solves my problem (using EF approach)
public ActionResult Index(int? page)
{
return View(db.TestUploadData2.OrderBy(x => x.SrNo).ToPagedList(page ?? 1, 100));
}
With SP approach I wrote SP which takes PageNo as parameter & returns total records from DB & 100 records for that page.
But here my problem is that how to display pager control in View.
Any suggestion for SP approach.....