在 asp.net 中启用分页功能来填充数据网格
我有启用分页的数据网格,每页可以有 10 行。我还有 16 行的 DataTable。我想用“for”循环动态填充数据网格,以遍历所有数据表并填充数据网格。
我知道当计数器到达第 11 行时会出现问题。当计数器为 11 时,我是否需要更改数据网格的页面?因为它不允许我在数据网格中添加超过 10 行。
如果有人能告诉我如何实施它,我将不胜感激。
提前致谢,
格雷格
I have datagrid with paging enabled that can have 10 rows per page. Also I have DataTable with 16 rows. I want to fill the datagrid dynamically with 'for' loop to go over all the DataTable and fill the DataGrid.
I understand that there is a problem when the counter will hit row 11. Do I need to change the page of the datagrid when counter will be 11? Because it doesnt let me add more than 10 rows in the datagrid.
Would appriciate if someone can tell me how to implement it.
Thanks in advance,
Greg
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这几乎就是我会做的。我没有使用
for
因为复选框的条件检查位于 ItemDataBound 中,通过这样做,DataGrid 将为我完成所有分页。标记:
代码隐藏:
这给出:
This is pretty much how I'd do it. I'm not using a
for
as the conditional checking of checkboxes is in ItemDataBound, by doing it this way the DataGrid will do all the paging for me.Markup:
Code-behind:
This gives: