I am using it like this:
<%= Html.Pager((IPagination)Model) %>
Is there are simple way to change the rendered url. I had a look for more documentation but couldn't find much.
I am using it like this:
<%= Html.Pager((IPagination)Model) %>
Is there are simple way to change the rendered url. I had a look for more documentation but couldn't find much.
What exactly do you want to change?
This is how I change the URL:
Html.Pager(Model.AssetsPagedList)
.First("First")
.Last("Last")
.Next("Next")
.Previous("Previous")
.Link(currentPage => Url.Action("Browse", new {
page = currentPage,
searchTerm = Model.SearchModel.SearchTerm,
excludedWords = Model.SearchModel.ExcludedWords,
minPrice = Model.SearchModel.MinPrice,
maxPrice = Model.SearchModel.MaxPrice,
locationId = Model.SearchModel.LocationId,
catalogId = Model.SearchModel.CatalogId
}))
You could also create a helper something like this:
public static Pager Pager(this HtmlHelper helper, IPagination model, FormCollection formCollection)
{
// here you can use MvcContrib.UI.Pager.PaginationExtensions.Pager static methods
// or create MvcContrib.Pagination.Pager class directly
}
It really depends on what do you want to change.
In the following sample I am changing the pagination links to use ajax
$("#addressListPlaceholder .paginationRight a").click(function (event) {
event.preventDefault();
$.ajax({
type: "get",
dataType: "html",
url: this.href,
data: {},
success: function (response) {
$("#addressListPlaceholder").html('').html(response);
}
});
});
You can pass in anything that is castable to IPagination. For example, see this SO question/answer: MvcContrib.UI.Grid pagination problem
You can also modify the pager after generation time using jQuery. See this post for an example: http://thekindofme.wordpress.com/2009/01/12/ajax-enabling-mvccontrib-grid-pagination-with-jquery/