Radgrid 的自定义分页不起作用
我在这里查看不同问题的答案,但无法找到我可以使用的东西,我是 RadGrid 的新手,一直使用 GridView,但现在,他们将它们全部更改为 RadGrid,其中之一需要自定义分页,有一个示例此处和我正在尝试使用它,但如果我的数据源是数据集,我不确定该怎么做,请参见下文,
AdminManager adminMan = new AdminManager();
DataSet ds = adminMan.GetProducts();
int startRowIndex = (ShouldApplySortFilterOrGroup()) ?
0 : Grid.CurrentPageIndex * Grid.PageSize;
int maximumRows = (ShouldApplySortFilterOrGroup()) ?
**HERE NOT SURE HOW TO TRANSLATE THIS SO THAT I CAN USE IT
MyBusinessObjectCollection1.SelectCount() : RadGrid1.PageSize;**
Grid.AllowCustomPaging = !ShouldApplySortFilterOrGroup();
**HERE NOT SURE HOW TO TRANSLATE THIS SO THAT I CAN USE IT
RadGrid1.DataSource = MyBusinessObjectCollection1.Select(startRowIndex, maximumRows);**
如您所见,我不确定在使用数据集时如何转换该示例代码。请参阅我注意到的部分“这里不确定如何翻译......”任何帮助将不胜感激。
问候
I was looking at the answers from different questions here but cant get to something that I can use, I am new to the RadGrid stuff had always used GridView but now, they changed them all to RadGrids and one of them needs to have the paging custom, there is an example here and I am trying to use it but i am not sure how to do it if my data source is a data set see below
AdminManager adminMan = new AdminManager();
DataSet ds = adminMan.GetProducts();
int startRowIndex = (ShouldApplySortFilterOrGroup()) ?
0 : Grid.CurrentPageIndex * Grid.PageSize;
int maximumRows = (ShouldApplySortFilterOrGroup()) ?
**HERE NOT SURE HOW TO TRANSLATE THIS SO THAT I CAN USE IT
MyBusinessObjectCollection1.SelectCount() : RadGrid1.PageSize;**
Grid.AllowCustomPaging = !ShouldApplySortFilterOrGroup();
**HERE NOT SURE HOW TO TRANSLATE THIS SO THAT I CAN USE IT
RadGrid1.DataSource = MyBusinessObjectCollection1.Select(startRowIndex, maximumRows);**
As you can see i am not sure how to trnaslate that example code when using a data set. See the parts where I am noting "Here not sure how to translate...." Any help would be appreciated.
Regards
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我对这个问题有点困惑,所以我将包括我的例子,说明什么是有效的,也许这会对你的努力有所帮助。首先,我在网格上设置这些:
在代码中,当绑定时,我这样做:
本质上,您绑定过滤结果,但将虚拟项目计数设置为记录总数。 RadGrid 还应该支持绑定到 DataSet,因此这应该不是问题。
I'm a little confused to the problem, so I'm going to include my example of what DID work, and maybe that will help you in your endeavor. To start, I set these on the grid:
In code, when time to bind, i do this:
Essentially, you bind the filtered result, but set the virtual item count to the total number of records. The RadGrid should also support binding to a DataSet as well, so that shouldn't be a problem.
这对我有用。
http ://www.telerik.com/community/forums/aspnet-ajax/grid/pager-arrows-problem-when-databinding-in-page-load.aspx
this worked for me.
http://www.telerik.com/community/forums/aspnet-ajax/grid/pager-arrows-problem-when-databinding-in-page-load.aspx
我无法添加评论,但我可以发布答案。乔的想法是正确的。我只需将其更改为下面的代码并将其添加到我的 aspx 页面的脚本块中。
谢谢乔!
I can't add a comment, but I can post an answer. Joe had the right idea. I just had to change it to the below code and add it to the script block of my aspx page.
Thanks Joe!