Today I'm going to write about Paging in ASP.NET MVC.

First, if someone asks you about paging, why?

Sometimes, we have too many rows, Photos, articles and Products you don't want to display all of them in same time,

or let's say, you don't want load 100K row in one click, this will be a big issue with your application.

  So, the solution will be is paging.

and don't forget to use IQueryable rather than List or IEnumerable.

Now, To work our first step is to create new ASP.NET MVC Project.

Follow the Photos.


Choose MVC,


Next Step, Add X.PagedList  From NuGet packages.

So, Now we need data to send it to our HTML page and display it in the table.

First, we need to create new Class in Models folder and call it Student.


Next Step, Create Folder Call it Services will put inside it,

a new class (IStudent class).



After Create our Interface, we need to create Repository Folder with StudentRepository class.

In StudentRepository Class, I have fake data just to show you how it will be in our HTML page.

sure you can Use data from your SQL Server database, using Entry Framework.