SharePoint 2010 External List Paging – Server Side
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的更多相关文章
- Upgrade from SharePoint 2010 to SharePoint 2016
[转]http://nikcharlebois.com/upgrade-from-sharepoint-2010-to-sharepoint-2016/ In this blog, I will go ...
- SharePoint 2010在win7 x64 安装
转:http://kaneboy.blog.51cto.com/1308893/328000 关于<SharePoint 2010应用程序开发指南>,我和杜伟同学正在撰写中,希望下半年早点 ...
- 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 ...
- 【SharePoint 2010】SharePoint 2010开发方面的课堂中整理有关问题
SharePoint 2010开发方面的课堂中整理有关问题陈希章 ares@xizhang.com1. 对于SharePoint的体系结构不甚清楚,觉得有点乱了解了就不会觉得乱了,请理解1) 场服务 ...
- SharePoint 2010开发方面的课堂中整理有关问题
SharePoint 2010开发方面的课堂中整理有关问题 这是我这几天在做一个SharePoint开发的课程的时候,大家提出的一些问题,及我的解答,分享给更多的朋友参考一下 这个文档,也可以在这里下 ...
- 分享微软官方Demo用的SharePoint 2010, Exchange 2010, Lync 2010虚拟机
微软官方有一套专门用于SharePoint 2010, Exchange 2010 Demo的虚拟机:SharePoint 2010: Information Worker Demonstration ...
- 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 ...
- How to tune SharePoint 2010 Server for better performance?
http://social.technet.microsoft.com/wiki/contents/articles/7926.sharepoint-2010-tips-for-dealing-wit ...
- 自定义和扩展 SharePoint 2010 Server 功能区
了解构成 SharePoint 2010 服务器功能区的组件以及如何通过演练两个功能区自定义项方案来自定义功能区. 适用范围: Microsoft SharePoint Foundation 2010 ...
随机推荐
- 解决php中echo出来的汉子乱码
问的人太多了,就列出来展示给大家! 需要了解的概念: Content-Type:用于定义用户的浏览器或相关设备如何显示将要加载的数据,或者如何处理将要加载的数据 MIME:MIME类型就是设定某种扩展 ...
- 【原】Configuring Oracle Data Guard In Physical Standby Database
作者:david_zhang@sh [转载时请以超链接形式标明文章] http://www.cnblogs.com/david-zhang-index/p/5042640.html参照文档:https ...
- 未在本地计算机上注册 Microsoft.Jet.OLEDB.4.0 提供程序
在C#的web程序中读取服务器端的Excel文件时所报的异常 问题描述:在Visual Studio中运行.调试均没有问题,但是部署到Windows Server 2008 64位操作系统的IIS7 ...
- 《编写高质量代码:改善C#程序的157个建议》源码下载
==== 目录 前 言第一部分 语言篇第1章 基本语言要素 / 2建议1:正确操作字符串 / 2建议2:使用默认转型方法 / 6建议3:区别对待强制转型与as和is / 9建议4:TryParse比P ...
- [Design Patterns] 2. Design principle
Single Responsibility Principle 类的设计趋向于:Use Case Diagram --> (derived) --> Detail Open-Closed ...
- eclispe使用外部tomcat总结
1. 配置tomcat Servers-->new 配置tomcat的路径,即可 2. 增加/移除application 注意:移除application时请使用"clean" ...
- 主机访问虚拟机中linux上的web服务
环境:主机windows xp 虚拟机centos 6.4 [root@localhost /]# iptables -I INPUT -p tcp --dport 80 -j ACCEPT[root ...
- 基于tiny4412的Linux内核移植 -- MMA7660驱动移植(九-2)
作者信息 作者: 彭东林 邮箱:pengdonglin137@163.com QQ:405728433 平台简介 开发板:tiny4412ADK + S700 + 4GB Flash 要移植的内核版本 ...
- 开源一个基于天天团购的团购app
可能大家都知道天天团购开源系统,一个做团购的开源项目很赞,前些日子做了基于天天团购系统做的团购客户端和移动端服务器!源代码放出,有了解的可以看看,希望收益! 先说服务器:app的服务器,基于天天团购的 ...
- 转载:第二弹!全球首个微信小程序(应用号)开发教程!通宵吐血赶稿!每日更新!
今天一波三折,承受了超出预料的压力和煎熬,最后还是决定继续放出我的更新教程.我想我一没有泄露公司的代码,二没有提供泄露开发工具下载,只是从程序猿角度写了篇开发日志.我已经做好了最坏的准备,就算放弃这份 ...