Implement Paging on ASP.NET #MVC #App in 5 Steps


Paging in ASP.NET MVC Application

To implement paging on an ASP.NET MVC Application following steps are to followed :-

Step 1 : Create a new C# ASP.NET Web project named Student_Management_System. Select the MVC template option in new ASP.NET Project dialog box and then click ok to create project.

Step 2 : PagedList.MVC should be installed from NuGet Package. This package helps in paging by providing various methods and properties. A paging helper named “PagedListPager” also gets installed by this package which helps in displaying paging buttons in views. A collection type named PagedList and various kind of extension methods are installed by PagedList package for IQueryable and IEnumerable collections.

In visual studio 2015 from Tools menu select NuGet package Manager and then Package Manager Console. In the Package Manager Console window run command “Install-Package PagedList.Mvc”.

Step 3 : Create a Model named Student

  1. using System.ComponentModel.DataAnnotations;
  2. namespace Student_Management_System.Models
  3. {
  4. public class Student
  5. {
  6. [Required]
  7. public string Fname { get; set; }
  8. [Required]
  9. public string Lname { get; set; }
  10. [Required]
  11. public string Email { get; set; }
  12. public Student(string fname, string lname, string email)
  13. {
  14. this.Fname = fname;
  15. this.Lname = lname;
  16. this.Email = email;
  17. }
  18. }
  19. }

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s