tags:

views:

699

answers:

2

HI, I'm having a Repeater bound to a ObjectDataSource. I retrieve my data using a Typed DataSet and my TableAdapter do query a subset of data according to a startIndex and pageSize. I'm all set for custom paging and it actually works.

However, I would like to know if it's possible for my TableAdapter to return a PagedDataSource, to bind my ObjectDataSource to it, all this using custom paging and coding my own pager using the PagedDataSource's properties.

At the moment, I'm storing a bunch of information in the ViewState such as the CurrentPage, IsFirstPage, IsLastPage, etc... An annoying thing here is that the ObjectDataSource's SelectCountMethod won't expose the result which is a must-have to create the pager... Basically I need to make another call to the database just to pick that value.

Inheriting the ObjectDataSource or ObjectDataSourceView just to expose the TotalRowCount is just too complicated, I've barely been able to make it work without adding any functionalities.

I've read a little about PagedDataSource and it feels like it can't do much Custom Paging along with a Repeater...

Any ideas?

+1  A: 

you could try a DataList along with a DataPager bound to your ODS. The DataList is similar to a repeater in that you have to explicitly declare the emitted markup, but offers more robust paging capabilities, especially along with the DataPager control. See these set of articles for more information on how to use the controls.

Josh E
I'm looking forward your idea +1, shouldn't take too long.
Maxime
I'm screwed, using 2.0 hehe... Will look for a kind DataPager for 2.0.
Maxime
doh... yeah that will make it much more difficult if you're stuck in 2.0 land.
Josh E
+1  A: 

This sounds almost exactly like what I just implemented a few days ago. I got a lot of help out of 4 Guys From Rolla. Check that article and it will show you how to set up a repeater with paging. Here is yet another 4GfR article.

TheTXI
Correct sir, however, this is default paging? and thus inefficient against large amount of data. The first link is interesting +1!
Maxime