Monthly Archives: May 2010

Pagination in MvcContrib

Over the next month or so, I’m hoping to write a couple of posts on some work I’ve undertaken in extending the original pager implementation that compliments the MvcContrib grid component.

The work I’ve undertaken so far has focused on the following areas:

Customisable Pager Rendering

The existing pager is rather limited in the HTML rendered out of the box. Currently the only means to gaining more control over the output would be to inherit from the existing Pager, override a few methods (you’d probably need to dig into the source to identify which ones), and to implement a new HTML helper. Support for this approach is limited by the current unit tests making expectations based on the complete mark-up.

The new pager will support complete customisation of rendering through custom templates, and

Support for Numeric Pagination (in addition to Next/Previous)

The existing pager component outputs as a “Next/Previous” style pager, with links for next/previous/first/last.

The new pager implementation will allow a choice of pager, with Next/Previous and Numeric pagers provided OOTB.

Separate Pagination Summary

Although the existing pager provides a summary with localization support, its implementation is embedded within the current pager. I would like to break this component out and separate its unit tests from the pager implementation, such that this component is optional and can change independently from the pager.

I’m looking for feedback on the work I’ve undertaken so far, and would welcome additional ideas and suggestions. The fork containing my work so far can be found here: https://hg01.codeplex.com/forks/craigcavalier/pagerextensions