MVC的contrib寻呼机

MVC的contrib寻呼机

本文介绍了MVC的contrib寻呼机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用它是这样的:

<%= 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.

推荐答案

你想改变究竟是什么?

这是我如何改变网址:

 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
    }

这篇关于MVC的contrib寻呼机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-04 23:10