Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/apache-spark/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 带PagedList的分页部分视图_Jquery_Ajax_Asp.net Mvc 4_Asp.net Mvc Partialview_Pagedlist - Fatal编程技术网

Jquery 带PagedList的分页部分视图

Jquery 带PagedList的分页部分视图,jquery,ajax,asp.net-mvc-4,asp.net-mvc-partialview,pagedlist,Jquery,Ajax,Asp.net Mvc 4,Asp.net Mvc Partialview,Pagedlist,我有一个有表格数据的局部视图。。 我正在使用寻呼 它在正常视图下运行良好,但当我尝试将其置于局部视图时,当我单击“下一步”或任何其他页面时,它只刷新整个页面,我的视图中断:( 我只想刷新partialview,这意味着在执行分页时,我只想更改partialview,而不是整个视图 这是分页的代码我的partialview Page @(Model.PageCount < Model.PageNumber ? 0 : Model.PageNumber) of @Model.PageCount

我有一个有表格数据的局部视图。。 我正在使用寻呼

它在正常视图下运行良好,但当我尝试将其置于局部视图时,当我单击“下一步”或任何其他页面时,它只刷新整个页面,我的视图中断:(

我只想刷新partialview,这意味着在执行分页时,我只想更改partialview,而不是整个视图

这是分页的代码我的partialview

Page @(Model.PageCount < Model.PageNumber ? 0 : Model.PageNumber) of @Model.PageCount
@Html.PagedListPager( Model, page => Url.Action("StudentList", new { page, sortOrder = ViewBag.CurrentSort, currentFilter=ViewBag.CurrentFilter }) )
@Model.PageCount的
Page@(Model.PageCountUrl.Action(“学生列表”,新建{page,sortOrder=ViewBag.CurrentSort,currentFilter=ViewBag.currentFilter}))
我试着用Ajax.ActionLink代替Url.Action,但没有成功。。。 有什么帮助吗?

嗯,我找到了答案。 其他人也有我刚刚发现的类似问题

这是:


它工作得很好。

您可以使用PagedListRenderopions.EnableUnobtrusiveAjaxReplacing对页面进行Ajax化,无链接返回部分视图

在控制器中:

 if (Request.IsAjaxRequest())
 {
    //viewModel=your viewModel
    return PartialView("viewModel");
  }
@Html.PagedListPager( Model, page => Url.Action("StudentList", new { page, sortOrder = ViewBag.CurrentSort, currentFilter=ViewBag.CurrentFilter }),PagedListRenderOptions.EnableUnobtrusiveAjaxReplacing( new AjaxOptions(){  HttpMethod = "GET", UpdateTargetId = "student_table"}) )
视图中:

 if (Request.IsAjaxRequest())
 {
    //viewModel=your viewModel
    return PartialView("viewModel");
  }
@Html.PagedListPager( Model, page => Url.Action("StudentList", new { page, sortOrder = ViewBag.CurrentSort, currentFilter=ViewBag.CurrentFilter }),PagedListRenderOptions.EnableUnobtrusiveAjaxReplacing( new AjaxOptions(){  HttpMethod = "GET", UpdateTargetId = "student_table"}) )
可能重复的