Ajax Pagination in PagedList.MVC using partial Page
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"})
)
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>
Alternatively , you can use jQuery Ajax to do so as below example.
https://github.com/ungleng/SimpleAjaxPagedListAndSearchMVC5