first_page the funky knowledge base
personal notes from way, _way_ back and maybe today

“Datalist paging with linq”; stackoverflow.com; Tomas Lycken

You will find the methods .Skip() and .Take() very useful.

I noticed you provided some code from your project, so here's an update on how you should implement these methods.

In your method for getting the data, do the following:

Dim query = (From st In db.students _ Order By st.st_studentid Ascending _ Select st).Skip((CurrentPage - 1) * PageSize).Take(PageSize)

Then provide the CurrentPage and PageSize variables as arguments to the method. (You don't want to build them into the data access, as they could vary across different parts of your site...)

[http://stackoverflow.com/questions/764364/datalist-paging-with-linq]

Note that Skip and Take come from Haskel set operations.

mod date: 2009-10-14T04:54:13.000Z