Click here to Skip to main content
15,867,453 members
Articles / Web Development / ASP.NET
Article

Paging a Repeater using an additional component

Rate me:
Please Sign up or sign in to vote.
2.00/5 (4 votes)
20 Jun 20072 min read 56.4K   526   25   21
A component that provides advanced way of data pagination with Repeater as renderring mechanism

Introduction

Programmers often face a problem how to display list of items to the user. There are several components integrated in framework such as datagrid, gridview that can do this work. But as you certainly know, the html output generated by this classes is quite "messy" and is unable to be modified in some easy way. The best known way is writing your custom css adapter in asp.net 2.0, but this is quite hard and doesnt give you a tool of changing pagers itself. Because of that I decided to write my custom component that provides this functionality hand in hand with repeater, that doesn't render more html than you define in templates.

RepeaterPager functionality

The paging functionality lays in Pager itself so when you're binding data you must provide it to the Pager, that processes the data and gives it to the repeater, which simply displays it.

Important attributes that you should know before using it are:

Templates
-there are many templates you can define such as NumericPagerTemplate, SelectedNumericPagerTemplate, Next and Previous PagerTemplate and so on. By setting template content the output html is all under your control.

MaxNumericPagers
- maximal count of displayed numeric pagers

PagersType
- type of pagers that are renderred by Pager, there are these options avaliable: OnlyWords, OnlyNumeric, NumbersBetweenWords, NumbersBehindWords, NumbersBeforeWords

PagingType
- is a system that gives a programmer two options of delivering data to the Pager. First is classic and second is VirualItems that supports only giving a data of current page and manually setting total datasource size.

RepeaterID
- is an ID of repeater control that is being paged

EmptySpaceSize
- is a number that defines minimial size of space between numeric pagers and first/last pager

VirtualItemsCount
- manually set size of datasource when using VirtualItems PagingType (see avaliable paging types)

Samples

In provided zip file you can find source codes and also three basic samples.

ClassicPagerSample.aspx - demonstrates standard data binding (corresponds to Classic PagingType)
VirtualItemsPagerSample.aspx - demonstrates virtual items mode data binding (see VirtualItemsCount attribute)
PagersTypeSample.aspx - page that shows pagers type that RepeaterPager disposes

Conclusion

I hope there is at least one programmer that will use this component to improve quality of his project's html and will have a fun with that.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
Czech Republic Czech Republic
ASP.NET programmer in W.D.A. Czech, s.r.o. company.

Comments and Discussions

 
GeneralMy vote of 1 Pin
pratrick127-Jan-10 22:34
pratrick127-Jan-10 22:34 
GeneralMultiple pagers with same datasource Pin
jason_from_cranstin9-May-08 3:59
jason_from_cranstin9-May-08 3:59 
GeneralRe: Multiple pagers with same datasource Pin
Petr Koutny14-May-08 12:51
Petr Koutny14-May-08 12:51 
GeneralRecords per page Pin
MeNot9-May-08 3:44
MeNot9-May-08 3:44 
GeneralRe: Records per page Pin
Petr Koutny14-May-08 12:48
Petr Koutny14-May-08 12:48 
QuestionVB version of component Pin
ZED023-Sep-07 20:08
ZED023-Sep-07 20:08 
GeneralRefreshing the pager Pin
notken2-Aug-07 1:56
notken2-Aug-07 1:56 
GeneralRe: Refreshing the pager Pin
arzion6-Nov-07 3:59
arzion6-Nov-07 3:59 
AnswerRe: Refreshing the pager Pin
notken7-Nov-07 23:13
notken7-Nov-07 23:13 
GeneralExcellent tool - thanks! Pin
notken7-Jun-07 0:16
notken7-Jun-07 0:16 
GeneralRe: Excellent tool - thanks! Pin
Petr Koutny10-Jun-07 6:25
Petr Koutny10-Jun-07 6:25 
AnswerRe: Excellent tool - thanks! Pin
ColorSMH26-Aug-07 7:06
ColorSMH26-Aug-07 7:06 
GeneralRe: Excellent tool - thanks! Pin
notken27-Aug-07 3:42
notken27-Aug-07 3:42 
QuestionDataSource being DataTable doesn't work Pin
Eva Rossa22-Apr-07 3:04
Eva Rossa22-Apr-07 3:04 
AnswerRe: DataSource being DataTable doesn't work Pin
Petr Koutny20-May-07 0:04
Petr Koutny20-May-07 0:04 
GeneralTrouble on PostBack... Plz help me out.. Pin
fayalif19-Apr-07 1:37
fayalif19-Apr-07 1:37 
GeneralRe: Trouble on PostBack... Plz help me out.. Pin
Petr Koutny19-May-07 23:59
Petr Koutny19-May-07 23:59 
QuestionData Source Pin
Baber Saeed16-Jan-07 10:38
Baber Saeed16-Jan-07 10:38 
AnswerRe: Data Source Pin
Petr Koutny16-Jan-07 11:17
Petr Koutny16-Jan-07 11:17 
GeneralI cant open this project. Help me Pin
akimngan3-Jan-07 22:40
akimngan3-Jan-07 22:40 
GeneralRe: I cant open this project. Help me Pin
Petr Koutny8-Jan-07 23:20
Petr Koutny8-Jan-07 23:20 
Hi. I'm pleased you like my pagination mechanism. Reason may be, that you aren't running this website "http://repeaterpager.net.local", see .webinfo file in root of archive and change the setting according to your environment.

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.