如何实现mvc分页视图

发布于 2024-09-16 02:04:16 字数 171 浏览 1 评论 0原文

您能告诉我使寻呼机 fpr 成为我的 asp.net mvc 视图的最佳方法吗? 我有一张典型的带有帖子的表格,它们将同时显示。 如果我有 30 个条目,我宁愿当时只显示 6 个。如果我能有一个类似菜单的东西来导航(比如 1 - 2 - 3 ),那就太好了。我想它可以是服务器端导航。

非常感谢并保重, 拉吉姆斯

Could you show me please the best methode to make pager fpr my asp.net mvc view?
I have a typical table with posts, and they will be all showed at one time.
If I have a 30 entries, i will preffer to show just 6 at the time. It will greate if I will have something like a menu to navigate ( like 1 - 2 - 3 ). It can be server side navigation i suppose.

Thanks a lot and take care,
Ragims

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

对岸观火 2024-09-23 02:04:16

使用 MvcContrib。除了网格和分页之外,它的包中还有大量有用的东西。

网格组件具有各种有用的功能,例如可排序的列、自动生成列名称、来自驼峰式命名属性。

这个教程应该有帮助你稍微出去一下,我有一个分页的网格,并在 5 分钟内运行。

更新:这是一个更好的 教程,订阅 Michael Ceranski 的 RSS 确实非常值得。他在控制器中使用存储库模式来获取数据(这是很好的实践),但您始终可以在控制器中将其替换为 LINQ(不是最佳实践)。

另请参阅 MVCcontrib 的作者 网站 如果您不想

使用 MVCContrib,那么可以使用 Nerddinner 的基本 分页类

Use MvcContrib. It's got loads of useful stuff in the package apart from grid's and pagination.

The grid component has all sort of useful features, like sortable columns, autogenerating column names, from camelCase-d properties.

This tutorial should help you out a bit, i had a grid with pagination up and running within 5 minutes.

Update: Here's a better tutorial, and indeed subscribing to Michael Ceranski's RSS is well worth doing. He is using the repository pattern in his controller to get the data (which is good practice) but you could always swap that out for LINQ in your controller (not best practise).

Also see the Author of MVCcontrib's website for more info

If you don't want to use MVCContrib then there's the basic pagination class from Nerddinner

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文