C# – Repeater, Custom Paging, PagedDataSource, possible

asp.netcpaging

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?

Best Answer

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.

Related Topic