tags:

views:

84

answers:

2

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.

A: 

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.

eglasius
I'm just not happy in terms of finding. Thank you very much, I'm going to throw in this study
Ognjen
I use LINQ in my ASP.NET MVC project
Ognjen
+1  A: 

Pretty simple :

var query = /* your Linq query */;
query = query.Skip(itemsPerPage * pageIndex).Take(itemsPerPage);
Thomas Levesque
what is * pageIndex?
Ognjen
The index of the current page. I assumed your question was related to paging... If it's not, you don't need the call to Skip, just use Take with the number of items you want to display
Thomas Levesque