Ognjen
Ognjen

Reputation: 1195

Limit rows in table per page

I would like to be able to limit the number of rows that can be in table on View page (I am using ASP.NET MVC), and if there are more rows, it goes to the next page.

Upvotes: 2

Views: 2896

Answers (2)

Thomas Levesque
Thomas Levesque

Reputation: 292475

Pretty simple :

var query = /* your Linq query */;
query = query.Skip(itemsPerPage * pageIndex).Take(itemsPerPage);

Upvotes: 5

eglasius
eglasius

Reputation: 36037

You will have a lot more luck finding the answer, if you say paging.

this is one approach

Asp.net mvc isn't like the regular asp.net, where you can get by without knowing a bit more of the underlying stuff.

Also note, that how exactly you implement paging in the controller & get the set of page links, depends on how you are getting a hold of your data.

Upvotes: 0

Related Questions