Click here to Skip to main content
Licence 
First Posted 12 Dec 2006
Views 31,102
Downloads 352
Bookmarked 25 times

Paging a Repeater using an additional component

By | 20 Jun 2007 | Article
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

About the Author

Petr Koutny

Web Developer

Czech Republic Czech Republic

Member

ASP.NET programmer in W.D.A. Czech, s.r.o. company.

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralMy vote of 1 Pinmemberpratrick122:34 27 Jan '10  
GeneralMultiple pagers with same datasource Pinmemberjason_from_cranstin3:59 9 May '08  
GeneralRe: Multiple pagers with same datasource PinmemberPetr Koutny12:51 14 May '08  
GeneralRecords per page Pinmemberannoyingwebsite@dodgeit.com3:44 9 May '08  
GeneralRe: Records per page PinmemberPetr Koutny12:48 14 May '08  
QuestionVB version of component PinmemberZED0220:08 3 Sep '07  
GeneralRefreshing the pager Pinmembernotken1:56 2 Aug '07  
GeneralRe: Refreshing the pager Pinmemberarzion3:59 6 Nov '07  
AnswerRe: Refreshing the pager Pinmembernotken23:13 7 Nov '07  
GeneralExcellent tool - thanks! Pinmembernotken0:16 7 Jun '07  
GeneralRe: Excellent tool - thanks! PinmemberPetr Koutny6:25 10 Jun '07  
AnswerRe: Excellent tool - thanks! PinmemberColorSMH7:06 26 Aug '07  
GeneralRe: Excellent tool - thanks! Pinmembernotken3:42 27 Aug '07  
QuestionDataSource being DataTable doesn't work PinmemberEva Rossa3:04 22 Apr '07  
AnswerRe: DataSource being DataTable doesn't work PinmemberPetr Koutny0:04 20 May '07  
GeneralTrouble on PostBack... Plz help me out.. Pinmemberfayalif1:37 19 Apr '07  
GeneralRe: Trouble on PostBack... Plz help me out.. PinmemberPetr Koutny23:59 19 May '07  
QuestionData Source PinmemberBaber Saeed10:38 16 Jan '07  
AnswerRe: Data Source PinmemberPetr Koutny11:17 16 Jan '07  
GeneralI cant open this project. Help me Pinmemberakimngan22:40 3 Jan '07  
GeneralRe: I cant open this project. Help me PinmemberPetr Koutny23:20 8 Jan '07  

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

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

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