使用 Repeater、SQL Server 和自定义寻呼机进行高效寻呼
我刚刚将以下文章上传到 codeproject:
http://www.codeproject.com/KB /webforms/efficientpagingrepeater.aspx
基本上它使用 Repeater、带有 ROW_NUMBER() OVER 语句的 SQL Server 和自定义分页器。
我想扩展寻呼机,以便它可以在单个页面上多次使用,并且还允许上一个/下一个按钮。我不确定该怎么做 - 有人可以提供建议/一些代码修改吗?
I have just uploaded the following article to codeproject:
http://www.codeproject.com/KB/webforms/efficientpagingrepeater.aspx
Basically it is using Repeater, SQL Server with the ROW_NUMBER() OVER statement and a custom pager.
I would like to extend the pager so that it can be used multiple times on a single page and also allow previous / next buttons. I am unsure how to do that - can anybody provide suggestions / some code modifications?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
CP还没有发表这篇文章,所以我不能对此发表评论。我可以说,几乎每个 DAL 工具(EF、NH、AR、Massive、Dapper.Net、Simple.Data)都内置了分页。因此,将分页连接到中继器根本不成问题。
如果本文指的是控制页面数据的 Web 表单服务器,我会不惜一切代价避免它。数据访问不应由 UI 组件管理。并且使用上面列出的各种 DAL 中的任何一种,使用代码而不是拖放控件来访问数据库非常简单。
要实现数据库分页,您需要 3 个输入和 2 个输出
输入
输出
使用记录总数和页大小就可以计算出总页数。
与结果页、当前页和您可以构建 UI 布局的总页面数
CP hasn't posted the article yet, so I cannot comment on that. I can say that just about every DAL tool (EF, NH, AR, Massive, Dapper.Net, Simple.Data) all have paging built in. so hooking up paging to a repeater should not be a problem at all.
If the article is referring to a webforms server control that pages data, I would avoid it at all costs. data access should not be managed by UI components. and using any of the various DAL listed above, it's very simple to access the database using code, instead of drag-n-drop controls.
to get db paging in place you need 3 inputs and 2 outputs
inputs
outputs
using the total number of records and the page size you can calculate the total number of pages.
with the page of results, current page & total number of pages you can build the UI layout
我希望这个解决你的问题。
I hope this resolves your question.