【问题标题】:How to do Custom Paging如何进行自定义分页
【发布时间】:2016-01-28 07:07:30
【问题描述】:

我想在我的Silverlight 应用程序中实现服务器端分页。为了了解我需要的步骤,我经历了这个custom paging in asp.net 他们在文章中描述了如何设计SQL 查询以根据Page RequestedTotal no of records per page 返回结果。然而,我对如何从我的 Silverlight 应用程序中调用它感到非常困惑。就像我将如何在c# 代码中指定它一样。

使用DataPager 的默认分页非常简单。

PagedCollectionView pagingCollection = new PagedCollectionView(e.Result); //e.Result contains `List` returned by the method that calls the stored procedure GetProducts
pagerProductGrids.Source = pagingCollection;
gridProductGrid.ItemsSource = pagingCollection; 

但我对自己做这件事的程序一无所知。比如我需要getsetPage Sizetotal no of records等属性,即我将如何配置我的DataGridDataPager以传递StartingRowIndexMaximum RowcOunt

请帮忙!

【问题讨论】:

    标签: c# silverlight datagrid server-side custom-paging


    【解决方案1】:

    几年前我遇到了this article,这对我来说就像一个魅力。我已将此添加到我的框架中,并且从那时起一直在重用此方法。这篇文章解释得很好,我相信这正是您要找的。​​p>

    Paging Data from the Server with Silverlight

    【讨论】:

    • 浏览了这篇文章,是的,这就是我想在我的应用程序中实现的,但我有几个问题:我尝试在我的类中实现 IPagedCollection 接口并尝试设置 @ 的值987654324@ 但我不能,因为它是read-only。所以我的问题是我不能在我的代码后面的类中实现这个接口吗?为什么我需要创建自定义数据源
    • 引用文章:In order to make a generic/ re-useable implementation of this paging interface, I first created an interface that would act as the source of the data. This interface is very simple, having a single method that fetches data for the given page. The result is returned asynchronously, providing both the items within the given page and the total item count.
    • 您是否尝试过查看文章末尾的可下载代码示例?
    猜你喜欢
    • 2016-04-15
    • 2012-08-28
    • 2021-07-17
    • 2020-01-22
    • 2013-04-29
    • 2017-07-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多