Asp.net mvc 分页机制
有没有一些优雅的方法,最好使用 jquery 插件,例如 pager 1 或 pager 2如何用asp.net mvc实现分页? 我试图回顾部分观点,但到目前为止还没有成功。 我应该在哪里存储加载的网格数据? 如何仅通过部分刷新来响应页面选择?
提前致谢。
is there some elegant way, ideally with jquery plugin like pager 1 or pager 2 how to implement paging with asp.net mvc? I am trying to go over partial views, but so far unsucessfully. Where should I store the loaded grid data? And how to respond on the page selection with just a partial refresh?
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
MVC Contrib Grid 附带分页功能。 也许值得一瞧。
The MVC Contrib Grid comes with paging functionality. Might be worth a look.
我建议查看 ScottGu 的 NerdDinner,他展示了如何制作寻呼机那里有 ASP.NET MVC。
一种方法是通过 URL 传输结果范围,即
...可以显示从 0 开始的 10 个产品。如果您有很多搜索字段,另一种方法是使用一个带有返回 JSON 的 List 操作的控制器,您可以使用 AJAX GET 调用的 XML 或 HTML 表。
但我强烈建议您查看 NerdDinner,因为他有一个如何执行此操作的示例。
I suggest checking out ScottGu's NerdDinner as he shows how to make a pager with ASP.NET MVC there.
One way you can do it is to transmit the result range via the URL, i.e.
...could show 10 products starting at 0. If you had many search fields, another way would be to have a contoller with a List action returning JSON, XML or an HTML table that you could call using an AJAX GET.
But I highly suggest checking out NerdDinner, as he has an example of how to do this.
您不会存储加载的数据。 MVC 允许您保持视图无状态,因此下一页控制器的回调需要包含所请求的页码。 然后您只需返回所需的行。 您还可以使用 AJAX 来实现这一点。
You wouldn't store the loaded data. MVC allows you to keep the view stateless, so the call back to the controller for the next page needs to include the page number being requested. Then you just return the rows required. You could also use AJAX for that.