tags:

views:

200

answers:

3

Hi,

How do I configure my datagrid to use paging such that it won't pull ALL the rows from the database, but rather only the rows for the current page.

BTW, should I be using a datagrid still or is there a newer control?

A: 

When I've implemented paging like this in the past, you can push the responsability on to SQL to do the paging assuming you tell it to the page number and size. This is dependant on the type of database your running.

Doing it on SQL Server 2000 is a litle complex but if your using that, I might have resources that I can dig out

Paging in SQL Server 2005 / 2008 is very easy.

As for how do you tell the DB, that depends on how your binding to your grid, and how your pulling your data.

JoshBerke
A: 

I think all "smart paging" code came from this entry by ScottGu

As far as alternatives to GridView, it all depends on your data. GridView is the best for tabular data; if you want more flexibility with the layout - consider ListView

roman m
A: 

As Josh mentioned, there are different ways to do it.

Check this question/answer for one variation: http://stackoverflow.com/questions/475982/asp-net-datagrid-and-custom-paging

eglasius