Ajax Pagination in PagedList.MVC using partial Pag

2019-01-13 08:28发布

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 }))

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

3条回答
forever°为你锁心
2楼-- · 2019-01-13 09:00

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"})
)
查看更多
三岁会撩人
3楼-- · 2019-01-13 09:06

People This Code dosent Work You Have To Add Microsoft.Jauery.unobtrusive-ajax To Work If You Don`t Add This Item Dose not Work

查看更多
Fickle 薄情
4楼-- · 2019-01-13 09:12

Alternatively , you can use jQuery Ajax to do so as below example.

https://github.com/ungleng/SimpleAjaxPagedListAndSearchMVC5

查看更多
登录 后发表回答