How should grid paging work?

I'm working on a new project , MVC, C#, VS 2017.

1. I stepped thru the code and looks like the grids get all the rows and then page thru.

2. I think code should get , for example,10 rows. Display those for page 1. User clicks on page 2. Code should grab the next 10 rows of data and display.
But it should NOT get the entire dataset upfront.

Now, how can I do that?
1. Stored proc to bring back chunks of data
2. Get total number of rows to display at the bottom of the grid
3. When grid is displayed the first time, stored proc will return 10 rows
4. User clicks on "page 2" and now I need to get the next 10 rows. So, what do I need to pass to the stored proc?

I think the index (what page # is clicked) needs to be tracked.
LVL 8
CamilliaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

MrunalCommented:
Hi Camilla
This depends on scenario (means data and operations on data)

I mean if data is less then you can bind all data in one server request and then let user play with that data.

If data is more and operation on per row/record is complex one then go for second option which is with stored procedure and count.

This will help you:

https://www.codeproject.com/Articles/807330/Paging-In-MVC-with-Entity-Framework
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
CamilliaAuthor Commented:
Thanks, let me take a look.
Users are bringing data up to 30,000+ rows.
0
CamilliaAuthor Commented:
Do you know how sorting should work without getting ALL the data upfront first? That link would work for paging and that's great.
0
MrunalCommented:
in most cases, sorting is applied to complete data source, means again request will be sent to server to get sorted data.
0
CamilliaAuthor Commented:
in most cases, sorting is applied to complete data source

Ah. That defeats the purpose of paging and bringing back only a small dataset.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.