Ajax Pagination in PagedList.MVC using partial Page

和自甴很熟 提交于 2019-11-27 18:23:56
Yogendra Paudyal

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

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

https://github.com/ungleng/SimpleAjaxPagedListAndSearchMVC5

pape moussa ndiaye

The code works, but you need to add the reference to jquery-unobtrusive-ajax.min.js into your main view or partial.

<script src="@Url.Content("~/Scripts/jquery.unobtrusive-ajax.min.js")" type="text/javascript"></script>
user8805778

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!