【问题标题】:Pagination in Partial View局部视图中的分页
【发布时间】:2013-07-03 11:52:13
【问题描述】:

我在部分视图中将动态选择的列显示为网格(使用 webgrid)。当我在部分视图 webgrid 上执行分页时,该部分视图网格单独在新页面中再次加载。我想获得部分视图的分页无需将部分视图单独重定向到新页面。

【问题讨论】:

  • 你能提供你的代码的sn-p吗?鉴于我还没有看到你的代码,我认为你可以使用 @@Ajax 帮助器的方法而不是 @@Html 来实现你的目标
  • @{ var grid1 = new WebGrid(Model.oTravelReadyEntities, canPage: true, rowsPerPage: 3,ajaxUpdateContainerId:"result"); grid1.Pager(WebGridPagerModes.NextPrevious); @grid1.GetHtml(tableStyle:“WebGrid”,headerStyle:“标题”,alternatingRowStyle:“alt”,列:ViewBag.Columns)}

标签: asp.net-mvc-3 jquery uiviewcontroller pagination razor-grid


【解决方案1】:

从您提供的代码来看,您似乎将 ajaxUpdateContainerId 设置为“结果”,但您的页面上没有任何具有该 id 的控件,您可以通过提供 HtmlAttributes 在 .GetHtml() 方法中设置 id。

所以编辑后的行看起来像这样:

@grid1.GetHtml(htmlAttributes: new { id="result" },tableStyle: "WebGrid", headerStyle: "Header", alternatingRowStyle: "alt", columns: ViewBag.Columns)

详情请查看this link

【讨论】:

  • 非常感谢。现在工作正常。
  • @user2514925 没问题,很高兴能帮上忙 :)
猜你喜欢
  • 2014-06-05
  • 1970-01-01
  • 2013-09-24
  • 1970-01-01
  • 2014-03-26
  • 2013-09-20
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多