Posts

Showing posts with the label MVC3

Create custom paging in ASP.NET MVC

Image
Sometimes we require to create custom paging in asp.net mvc application to do that we can use pager. Follow below steps: 1.)Go to package manager and download two packages: 2.) Go to controller and add following code. a) Add using PagedList; in top. b)Write your query as     var person = (from p in personList                           select p).ToPagedList(page, 10); here ToPagedList method takes two parameter first one page number and second page size. Complete code for a\controller action method is :  List<Person> personList = new List<Person>();         public ActionResult Index(int page = 1)         {             personList.Add(new Person                 {                     Id = 1,       ...