如何进行自定义分页

时间:2016-01-28 07:07:31

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

我想在我的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; 

但我对自己做这件事的程序一无所知。就像getset Page Sizetotal no of records等所需要的属性一样,即我如何配置DataGrid和{{1}传递DataPagerStartingRowIndex

请帮忙!

1 个答案:

答案 0 :(得分:0)

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

Paging Data from the Server with Silverlight