PagedList.MVC 中的 Ajax 分页使用部分页面 [英] Ajax Pagination in PagedList.MVC using partial Page

查看:36
本文介绍了PagedList.MVC 中的 Ajax 分页使用部分页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我不使用部分页面,PagedList.Mvc 工作正常,但是当我使用带有 ajax 的部分页面加载网格时,分页出现问题.我以 TroyGoode https://github.com/TroyGoode/PagedList/issues/26#issuecomment-6471793,但为支持提供的链接是不工作.现在,我是这样用的

PagedList.Mvc is working fine if I do not use partial page but when I use partial page with ajax to load the grid then there is problem in pagination.and I ended with the support from TroyGoode https://github.com/TroyGoode/PagedList/issues/26#issuecomment-6471793, But link provided for the support is not working. Right now, I have used like this

@Html.PagedListPager((IPagedList)Model.MovieInforamtions, page => Url.Action("GetMovieDatabase", new { page }))

,它加载页面,但我需要以ajax方式更改分页.我怎样才能做到这一点?

, which loads the page but I need to change the pagination ajaxically. How can I achieve this?

推荐答案

这个问题是通过使用 PagedListRenderOptions.EnableUnobtrusiveAjaxReplaceing 解决的.

This issue is solved by using PagedListRenderOptions.EnableUnobtrusiveAjaxReplacing.

@Html.PagedListPager(
    Model.MovieInforamtions, 
    page => Url.Action("GetMovieDatabase", new { page = page}),
    PagedListRenderOptions.EnableUnobtrusiveAjaxReplacing(new AjaxOptions(){  HttpMethod = "GET", UpdateTargetId = "movie_grid"})
)

这篇关于PagedList.MVC 中的 Ajax 分页使用部分页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆