thoughts on coding

March 5, 2009

ASP.NET MVC Pager

Filed under: .NET, ASP.NET MVC — Tags: , , — Frantisek @ 10:24 pm

Based on the feedback I’ve got I decided to write more about the pager I wrote in recent days. I use this control with MVCContrib Grid control.

The main difference is that my Pager control doesn’t required the IPagination interface.

You can call it like this:

<%=Html.Pager(Model.Search.CurrentPageIndex, Model.Search.MaxRowsPerPage, Model.Search.TotalRowCount)%>

That’s all and it will look like the following picture:

pager

The code can be downloaded from here The link points to the ZIP file which contains 2 files, both are extensions. When you want to use the pager you havet o reference latest MVCContrib library as the pager links are built using MVCCongrib.UI.Tags.Link class.

When I use MVCContrib library I use to add the namespaces to the web.config.  Just FYI: you need to add to web.config the following:

<add namespace="MvcContrib.UI.Pager"/>

That’s all for now. Next will be ordering :o)

Advertisements
« Newer Posts

Blog at WordPress.com.