从PagedList

时间:2019-06-12 09:07:53

标签: asp.net-mvc url-parameters pagedlist

问题是我需要将模型数据传递给PagedList进行操作,但是url看起来很丑http://localhost:42270/ChooseLawyer?Page=2&IdLawyer=0&FirstName=%D0%90%D0%BB%D0%B1%D0%B5%D0%BD%D0%B0&CurrentStatus=0&IsActive=False.I要从url中隐藏查询。在这种情况下,我使用MVC 4。 这是我的动作:

public ActionResult SortAuthorityLawyers(AuthoritySearchViewModel model)
        {

在那个模型中,我想保持搜索状态。

<div class="col-md-12 mt-3" align="right">
    @pagenation @(lawyers.PageCount < lawyers.PageNumber ? 0 : lawyers.PageNumber) от @lawyers.PageCount
</div>
<div class="text-center  col-12 mb-5" style="overflow-y:auto">
    @Html.PagedListPager(lawyers, page => Url.Action(action, new { page,Model.TopagedList}))

</div>

routes.MapRoute(
                     name: "SortAuthorityLawyers",
                      url: "Избери-нов-адвокат",
                       defaults: new { controller = "Admin", action = "SortAuthorityLawyers" }
                 );

0 个答案:

没有答案