Click here to Skip to main content
12,451,425 members (46,579 online)
Click here to Skip to main content
Add your own
alternative version

Stats

42.5K views
507 downloads
25 bookmarked
Posted

Paging a Repeater using an additional component

, 20 Jun 2007
Rate this:
Please Sign up or sign in to vote.
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

Share

About the Author

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

You may also be interested in...

Pro
Pro

Comments and Discussions

 
GeneralMy vote of 1 Pin
pratrick127-Jan-10 22:34
memberpratrick127-Jan-10 22:34 
GeneralMultiple pagers with same datasource Pin
jason_from_cranstin9-May-08 3:59
memberjason_from_cranstin9-May-08 3:59 
GeneralRe: Multiple pagers with same datasource Pin
Petr Koutny14-May-08 12:51
memberPetr Koutny14-May-08 12:51 
GeneralRecords per page Pin
annoyingwebsite@dodgeit.com9-May-08 3:44
memberannoyingwebsite@dodgeit.com9-May-08 3:44 
GeneralRe: Records per page Pin
Petr Koutny14-May-08 12:48
memberPetr Koutny14-May-08 12:48 
QuestionVB version of component Pin
ZED023-Sep-07 20:08
memberZED023-Sep-07 20:08 
GeneralRefreshing the pager Pin
notken2-Aug-07 1:56
membernotken2-Aug-07 1:56 
GeneralRe: Refreshing the pager Pin
arzion6-Nov-07 3:59
memberarzion6-Nov-07 3:59 
AnswerRe: Refreshing the pager Pin
notken7-Nov-07 23:13
membernotken7-Nov-07 23:13 
GeneralExcellent tool - thanks! Pin
notken7-Jun-07 0:16
membernotken7-Jun-07 0:16 
GeneralRe: Excellent tool - thanks! Pin
Petr Koutny10-Jun-07 6:25
memberPetr Koutny10-Jun-07 6:25 
AnswerRe: Excellent tool - thanks! Pin
ColorSMH26-Aug-07 7:06
memberColorSMH26-Aug-07 7:06 
GeneralRe: Excellent tool - thanks! Pin
notken27-Aug-07 3:42
membernotken27-Aug-07 3:42 
QuestionDataSource being DataTable doesn't work Pin
Eva Rossa22-Apr-07 3:04
memberEva Rossa22-Apr-07 3:04 
AnswerRe: DataSource being DataTable doesn't work Pin
Petr Koutny20-May-07 0:04
memberPetr Koutny20-May-07 0:04 
GeneralTrouble on PostBack... Plz help me out.. Pin
fayalif19-Apr-07 1:37
memberfayalif19-Apr-07 1:37 
GeneralRe: Trouble on PostBack... Plz help me out.. Pin
Petr Koutny19-May-07 23:59
memberPetr Koutny19-May-07 23:59 
QuestionData Source Pin
Baber Saeed16-Jan-07 10:38
memberBaber Saeed16-Jan-07 10:38 
AnswerRe: Data Source Pin
Petr Koutny16-Jan-07 11:17
memberPetr Koutny16-Jan-07 11:17 
GeneralI cant open this project. Help me Pin
akimngan3-Jan-07 22:40
memberakimngan3-Jan-07 22:40 
GeneralRe: I cant open this project. Help me Pin
Petr Koutny8-Jan-07 23:20
memberPetr Koutny8-Jan-07 23:20 

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.

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.160826.1 | Last Updated 21 Jun 2007
Article Copyright 2006 by Petr Koutny
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid