Asp.net mvc 对部分页面使用PagedList.Mvc

Asp.net mvc 对部分页面使用PagedList.Mvc,asp.net-mvc,asp.net-mvc-3,asp.net-ajax,Asp.net Mvc,Asp.net Mvc 3,Asp.net Ajax,我在一个页面中有四个不同的选项卡,每个选项卡的数据由使用部分页面的ajax调用呈现。选项卡的数据由ajax post加载。 ajax调用: $('#movieDatabase').click(function () { $.ajax({ contentType: 'application/json; charset=utf-8', dataType: 'html', ty

我在一个页面中有四个不同的选项卡,每个选项卡的数据由使用部分页面的ajax调用呈现。选项卡的数据由ajax post加载。 ajax调用:

  $('#movieDatabase').click(function () {

            $.ajax({
                contentType: 'application/json; charset=utf-8',
                dataType: 'html',
                type: 'POST',
                url: '/Admin/GetMovieDatabase',
                data: {},
                success: function (data) {
                    $('#view16').html(data);
                },
                failure: function (response) {
                    alert('error');
                    $('#view16').html(response);
                }
            });
        });
此ajax调用呈现了部分页面。现在我要做的是对来自数据库的电影进行分页。为此,我使用PagedList.Mvc。但在将电影从一个页面导航到另一个页面时出现了问题。通过以下方式完成:

 @Html.PagedListPager((IPagedList)Model.MovieInforamtions, page => Url.Action("GetMovieDatabase", new { page }))
但当我点击下一页时,它给出了page not found错误,因为我并没有在HTTPGet中编写任何操作。若我通过HTTPGet进行上述调用,我不能呈现所有页面,只能呈现部分页面。我的行动是

 [HttpPost]
 public ActionResult GetMovieDatabase(int? page)
 {
      var AdminGetMovieDatabaseViewModel = new AdminGetMovieDatabaseViewModel();
      var allMovie = _AdminService.getAllMovieInfo();
      var pageNumber = page ?? 1; 
      // if no page was specified in the querystring, default to the first page (1)
      var onePageOfMovie = allMovie.ToPagedList(pageNumber, 5); 
      // will only contain 5 products max because of the pageSize

      AdminGetMovieDatabaseViewModel.MovieInforamtions = onePageOfMovie;

      return PartialView("MovieDataBasePartialPage", AdminGetMovieDatabaseViewModel);
   }

现在,我如何像以前那样在ajax调用中呈现下一个页面

我将javascript部分中的代码放在部分视图中,并为我工作

<script language ="javascript" type="text/javascript">
$('#movieDatabase').click(function () {

            $.ajax({
                contentType: 'application/json; charset=utf-8',
                dataType: 'html',
                type: 'POST',
                url: '/Admin/GetMovieDatabase',
                data: {},
                success: function (data) {
                    $('#view16').html(data);
                },
                failure: function (response) {
                    alert('error');
                    $('#view16').html(response);
                }
            });
        });
    </script>

$(“#电影数据库”)。单击(函数(){
$.ajax({
contentType:'application/json;charset=utf-8',
数据类型:“html”,
键入:“POST”,
url:“/Admin/GetMovieDatabase”,
数据:{},
成功:功能(数据){
$('#view16').html(数据);
},
故障:功能(响应){
警报(“错误”);
$('#view16').html(回复);
}
});
});