http://lightningtools.com/bcs/sharepoint-2010-external-list-paging-server-side/

When you are using an External List to display data through the Business Connectivity Services from your External Data Source you do not want to be bringing back thousands of records of data. This is a bad setup in terms of performance hit on the hardware and also experience of the end user as they may only want 20 records displayed at a time, so no need to bring them all over. What we need to do is allow an External List to page through the data, executing a query on the External Data Source so only the current records required for what the user wants to review are returned. This is known as server side paging.

In this walkthrough we’ll show you how to configure a BCS finder method to provide custom paging. We will use BCS Meta Man to create an external content type and configure the finder method to provide custom paging ability.

1) Launch Visual Studio 2010 and create a new empty SharePoint project. Add a BCS Meta Man project item from the Lightning Tools project items group. Connect to your database(we have used AdventureWorks2000 database in this walkthrough) by using the main menu BCS Meta Man –> BCS Meta Man Data Explorer and connect to your database you wish to use. It should looked like this

[Please click the images for a larger view]

2) Drag and drop a table from the data source explorer on to design surface. Choose .Net Assembly as a model type.

3) Now we need to create two filters. The first one will keep information about the records count per page, and the second one will keep information about the start row. Using these values we can support custom paging. Right click on the external content type, and choose “Manage Entity”

4) Navigate to the Methods tab and select the finder method. Click on the Add Filter button. We will create a filter for records count per page. Set 30 as a default value.

5) Create another filter for first row number, using the same way that is described in step 4. We need to use a nullable type column for that filter because later when we will try to retrieve first row number information from the external list, we will see that value is null for the first page, so to avoid exceptions we need to create this filter on a nullabe type column. We have used SalesPersonId column of the Customer table. Set 1 as a default value.

6) Now we need to make a small modification to the C# code that is generated for our Finder method. To support custom paging, each time we need to retrieve (N*C+1) records, where N is the page number, C is records count per page, and we need to add 1 extra row so that SharePoint knows it can page. So for example if you want first 30 records and paging enabled, you need to retrieve 31 records. When the Next/Page button is clicked, it should retrieve 61 records but the start row number set to 31. We need to modify the finder method code, and it should looked like this.

7) Now you can press F5 to deploy the solution, go to SharePoint site and create a new external list based on the deployed external content type. When list is created, go and modify the view.

8) On the Edit List View page scroll down and you’ll find the place to set values for the filters that we created in step 4 and 5. You need to set {dvt_firstrow} as the value for RowNumber filter. {dvt_firstrow} is an argument value that is being posted by an external list when you click on next/previous buttons. It holds the value of the first row number of an external list. So if you click on next button and it navigates to the second page which contains the second 30 records, {dvt_firstrow} will be equal to 31. Here is the screenshot of that post back.

9) For the RecordsCount filter value, you should set this to be the same value that is specified in your external list’s Items Limit section. Using this value it should retrieve the next bunch of records. In Edit View, if you go to Items Limit section you’ll see 30 as the default value. Lets change it to 10.

10) Finally here is the screenshot of the values of our defined BCS filters.

So, when we have dvt_firstrow and RecordsCount values we can calculate the value of N = dvt_firstrow/RecordsCount+1. For example, if our page contains 10 records, and dvt_firstrow = 21(which means that it should show records from 21 to 30), then N=21/10+1 which is equal to 3. So, N*C+1 = 3*10+1=31. So it will retrieve 31 records and external list will show records from 21 to 30.

Using this technique we can provide custom paging of our external content list .

SharePoint 2010 External List Paging – Server Side的更多相关文章

  1. Upgrade from SharePoint 2010 to SharePoint 2016

    [转]http://nikcharlebois.com/upgrade-from-sharepoint-2010-to-sharepoint-2016/ In this blog, I will go ...

  2. SharePoint 2010在win7 x64 安装

    转:http://kaneboy.blog.51cto.com/1308893/328000 关于<SharePoint 2010应用程序开发指南>,我和杜伟同学正在撰写中,希望下半年早点 ...

  3. Integrate SharePoint 2013 with Team Foundation Server 2012

    Now that SharePoint 2013 is out I want to make sure that I can integrate SharePoint 2013 with Team F ...

  4. 【SharePoint 2010】SharePoint 2010开发方面的课堂中整理有关问题

    SharePoint 2010开发方面的课堂中整理有关问题陈希章 ares@xizhang.com1. 对于SharePoint的体系结构不甚清楚,觉得有点乱了解了就不会觉得乱了,请理解1) 场服务 ...

  5. SharePoint 2010开发方面的课堂中整理有关问题

    SharePoint 2010开发方面的课堂中整理有关问题 这是我这几天在做一个SharePoint开发的课程的时候,大家提出的一些问题,及我的解答,分享给更多的朋友参考一下 这个文档,也可以在这里下 ...

  6. 分享微软官方Demo用的SharePoint 2010, Exchange 2010, Lync 2010虚拟机

    微软官方有一套专门用于SharePoint 2010, Exchange 2010 Demo的虚拟机:SharePoint 2010: Information Worker Demonstration ...

  7. Searching External Data in SharePoint 2010 Using Business Connectivity Services

    from:http://blogs.msdn.com/b/ericwhite/archive/2010/04/28/searching-external-data-in-sharepoint-2010 ...

  8. How to tune SharePoint 2010 Server for better performance?

    http://social.technet.microsoft.com/wiki/contents/articles/7926.sharepoint-2010-tips-for-dealing-wit ...

  9. 自定义和扩展 SharePoint 2010 Server 功能区

    了解构成 SharePoint 2010 服务器功能区的组件以及如何通过演练两个功能区自定义项方案来自定义功能区. 适用范围: Microsoft SharePoint Foundation 2010 ...

随机推荐

  1. NTKO Officecontrol在线Word编辑器的使用

    1.何时进行手工卸载和安装 一般情况下应该让客户端自动控件,这样当服务器控件版本更新时,客户端可以获得自动升级方面的好处.但是,如果因为客户机配置有问题,或者有其它拦截工具拦截的原因无法自动安装控件, ...

  2. 暴力清除Android中的短信

    有些短信程序有bug,当短信(特别是彩信)没有接收完整,或者是一些异常情况下,你会收到一条短信但是看不到或者看不了. 此时郁闷的事情就来了,系统会提醒你还有1条未读短信,但是你满世界都找不到这条短信. ...

  3. Android通过编码实现GPS开关

    在Android 2.2以后才可使用 import android.content.ContentResolver; import android.content.Context; import an ...

  4. MongoDB的学习--文档的插入、删除和更新

    最近在看<MongoDB权威指南>,写博客记录一下相关内容~~ 关于安装之类的最基本的就不多说了,从基本操作增删改查开始. MongoDB官网地址:http://www.mongodb.o ...

  5. linux shell 流程控制(条件if,循环【for,while】,选择【case】语句实例 --转载

    http://www.cnblogs.com/chengmo/archive/2010/10/14/1851434.html nux shell有一套自己的流程控制语句,其中包括条件语句(if),循环 ...

  6. 【转载】给VM虚拟机增加硬盘容量

    转载自:http://www.douban.com/note/53678368/ vmware-vdiskmanager [选项]这里的选项你必须包含以下的一些选择项或参数选项和参数描述<dis ...

  7. 查找表或其他对象在某个Server上的存在

    EXEC sp_MSforeachdb 'use ? ;  IF EXISTS(SELECT top 1 1 FROM sys.syscomments WHERE text LIKE ''%test% ...

  8. 1215 spring 3 项目更新

    列志华 (组长) http://www.cnblogs.com/liezhihua/ 团队guihub https://github.com/LWHTF/OrderingFood 黄柏堂 http:/ ...

  9. Node.js下基于Express + Socket.io 搭建一个基本的在线聊天室

    一.聊天室简单介绍 采用nodeJS设计,基于express框架,使用WebSocket编程之 socket.io机制.聊天室增加了 注册登录模块 ,并将用户个人信息和聊天记录存入数据库. 数据库采用 ...

  10. log4net日志记录

    这里是接着上一篇来优化的,上篇:ASP.NET MVC中错误日志信息记录 log4Net是用来记录日志的,可以将程序运行过程中的信息输出到一些地方(文件,数据库,EventLog等),日志就是程序的黑 ...