Paging, Filtering and Sorting

L

LDD

Hi Folks

I'm trying to determine a way to handle paging, filtering and sorting in a
datagrid.
If I choose to filter and sort, I'd like to return a subset. If that
resultset has more records then the number of rows I'd like to display, I'd
like to be able to load pages into the grid.

My question is, do I need to continually hit the db to get the next page of
records, or is there another method of doing with the dataset. i.e. load the
entire resultset into the dataset and pick up the next block of results as
neeeded.

thanks folks

LDD
 
M

Marina

Take a look at the PagedDataSource class. It can do the paging for you, and
you can use a DataView to filter/sort. So point the PagedDataSource to your
filtered/sorted DataView, and you should be all set.
 
L

LDD

I should have mentioned this is a windows form datagrid

I don't think I can use the PagedDataSource class

LDD
 
M

Marina

You are right, you can't.

You can still do all the filtering/sorting through the dataview.

Are you sure you need paging in a windows application? It is typically not
used since grids are much more functional, and there is no issue with
network latency sending the HTML down to the client.

If you do really need paging, I"m not sure what there is out there for that.
You may have to roll your own.
 
L

LDD

thanks for your help folks

The reason I want to use the paging is because of the number of records.
Loading 300k + records can take up some resources.

What I think I'll end up doing is, simply run the modified query each time
against the database, and using the overloaded Fill method for the
dataadapter, only show a chunk at a time in the grid. As the user navigates
through the pages, I'll update the fill method and reflect the changes in
the grid.

I may also set this up with a dataview and compare the performance of the
two approaches.

LDD
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top