Asp.net-Mvc
PagedList.MVC 中的 Ajax 分頁使用部分頁面
如果我不使用部分頁面,PagedList.Mvc 工作正常,但是當我使用帶有 ajax 的部分頁面載入網格時,分頁出現問題。我在 TroyGoode https://github.com/TroyGoode/的支持下結束PagedList/issues/26#issuecomment-6471793,但是為支持提供的連結不起作用。現在,我是這樣使用的
@Html.PagedListPager((IPagedList)Model.MovieInforamtions, page => Url.Action("GetMovieDatabase", new { page })),它會載入頁面,但我需要以 ajaxically 方式更改分頁。我怎樣才能做到這一點?
通過使用 PagedListRenderOptions.EnableUnobtrusiveAjaxReplacing 解決了這個問題。
@Html.PagedListPager( Model.MovieInforamtions, page => Url.Action("GetMovieDatabase", new { page = page}), PagedListRenderOptions.EnableUnobtrusiveAjaxReplacing(new AjaxOptions(){ HttpMethod = "GET", UpdateTargetId = "movie_grid"}) )