views:

687

answers:

1

I'm using datalist in my application and i'm binding datalist with lisq to sql

dim db=new linqdatacontext(); var products=from p in db.products select p; datalist.datasource=products; datalist.databind();

now how can i do paging in my datalist?

+1  A: 

Use keywords Take and Skip

var products=from p in db.products select p 
             Skip NUMER_TO_START Take NUMBER_TO_TAKE

Very simple, consider there are 1000 rows of results in p, and Skip 50 means you are not going take results #1-#50, and it will give you results from #51, Take is simply how many records you need.

xandy
Thanks a lot. That's quite helpful.
Vicheanak