一步一步webpart-两个WebPart之间交换数据(8)
2006-09-22 13:30
405 查看
说明:
本项目中涉及webpart数据提供者和数据使用者两个类
提供者可以向使用者提供:
一项数据(Cell)
一行数据(Row)
一个表的数据(List)
查询过滤器(Filter)
参数(Parameters)
创建项目:
1.新建一个webpartLibrary项目,取名为WebPartLibrary5;
2.删除自动产生的webpart1.cs和webpart1.dwp;
3.新建一个"provider web part"取名为CityProvider.cs,代码如下:
using System;
using System.ComponentModel;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Xml.Serialization;
using System.Security;
using System.Security.Permissions;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Utilities;
using Microsoft.SharePoint.WebPartPages;
using Microsoft.SharePoint.WebPartPages.Communication;
namespace WebPartLibrary5
4.新建CityProvider的部署文件CityProvider.dwp,代码如下:
<?xml version="1.0" encoding="utf-8"?>
<WebPart xmlns="http://schemas.microsoft.com/WebPart/v2" >
<Title>CityProvider</Title>
<Description>一个提供城市名称的WebPart</Description>
<Assembly>WebPartLibrary5</Assembly>
<TypeName>WebPartLibrary5.CityProvider</TypeName>
<!-- Specify initial values for any additional base class or custom properties here. -->
</WebPart>
5.新建一个"consumer web part"取名为CityConsumer.cs,代码如下:
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.ComponentModel;
using System.Xml.Serialization;
using System.Security;
using System.Security.Permissions;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Utilities;
using Microsoft.SharePoint.WebPartPages;
using Microsoft.SharePoint.WebPartPages.Communication;
namespace WebPartLibrary5
6.新建CityConsumer的部署文件CityConsumer.dwp,代码如下:
<?xml version="1.0" encoding="utf-8"?>
<WebPart xmlns="http://schemas.microsoft.com/WebPart/v2" >
<Title>CityConsumer</Title>
<Description>一个接收城市名称的WebPart</Description>
<Assembly>WebPartLibrary5</Assembly>
<TypeName>WebPartLibrary5.CityConsumer</TypeName>
<!-- Specify initial values for any additional base class or custom properties here. -->
</WebPart>
7.部署两个webpart
我是通过Cabman2003部署的,请参见一步一步webpart-将WebPart部署到SPS服务器(7)
8.连接数据提供者于数据使用者
*****点击CityProvider WebPart右上方的菜单按钮,选择“连接、提供一个城市名称给:""CityConsumer”
或
*****点击CityConsumer WebPart右上角的菜单按钮,选择“连接、从…处接收一个城市名称""CityProvider”
即将两个webpart链接起来。
本项目中涉及webpart数据提供者和数据使用者两个类
提供者可以向使用者提供:
一项数据(Cell)
一行数据(Row)
一个表的数据(List)
查询过滤器(Filter)
参数(Parameters)
创建项目:
1.新建一个webpartLibrary项目,取名为WebPartLibrary5;
2.删除自动产生的webpart1.cs和webpart1.dwp;
3.新建一个"provider web part"取名为CityProvider.cs,代码如下:
using System;
using System.ComponentModel;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Xml.Serialization;
using System.Security;
using System.Security.Permissions;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Utilities;
using Microsoft.SharePoint.WebPartPages;
using Microsoft.SharePoint.WebPartPages.Communication;
namespace WebPartLibrary5
4.新建CityProvider的部署文件CityProvider.dwp,代码如下:
<?xml version="1.0" encoding="utf-8"?>
<WebPart xmlns="http://schemas.microsoft.com/WebPart/v2" >
<Title>CityProvider</Title>
<Description>一个提供城市名称的WebPart</Description>
<Assembly>WebPartLibrary5</Assembly>
<TypeName>WebPartLibrary5.CityProvider</TypeName>
<!-- Specify initial values for any additional base class or custom properties here. -->
</WebPart>
5.新建一个"consumer web part"取名为CityConsumer.cs,代码如下:
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.ComponentModel;
using System.Xml.Serialization;
using System.Security;
using System.Security.Permissions;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Utilities;
using Microsoft.SharePoint.WebPartPages;
using Microsoft.SharePoint.WebPartPages.Communication;
namespace WebPartLibrary5
6.新建CityConsumer的部署文件CityConsumer.dwp,代码如下:
<?xml version="1.0" encoding="utf-8"?>
<WebPart xmlns="http://schemas.microsoft.com/WebPart/v2" >
<Title>CityConsumer</Title>
<Description>一个接收城市名称的WebPart</Description>
<Assembly>WebPartLibrary5</Assembly>
<TypeName>WebPartLibrary5.CityConsumer</TypeName>
<!-- Specify initial values for any additional base class or custom properties here. -->
</WebPart>
7.部署两个webpart
我是通过Cabman2003部署的,请参见一步一步webpart-将WebPart部署到SPS服务器(7)
8.连接数据提供者于数据使用者
*****点击CityProvider WebPart右上方的菜单按钮,选择“连接、提供一个城市名称给:""CityConsumer”
或
*****点击CityConsumer WebPart右上角的菜单按钮,选择“连接、从…处接收一个城市名称""CityProvider”
即将两个webpart链接起来。
相关文章推荐
- 一步一步webpart-两个WebPart之间交换数据(8)
- 十分钟轻松搞定两个不同数据库之间的数据交换
- Exchanger两个线程之间的数据交换
- 关于两个窗体之间交换数据
- Exchanger两个线程之间交换数据
- [原创]两个listbox之间操作数据交换的问题!
- 安卓使用aidl实现两个程序之间的数据交换
- 黑马程序员-Condition条件对象、Semaphore、CyclicBarrier、倒计时门栓 CountDownLatch、Exchanger(实现两个线程之间数据交换
- 不用临时变量 实现两个变量之间的数据交换
- 两个服务器之间的数据数据交换的核…
- Android两个Activity之间的数据交换
- 如何在两个ViewController之间传递数据
- 请问MVC4是不是类似于html页+ashx页之间用JSON通过AJAX交换数据这种方式、?
- Android中在两个Activity之间进行数据传递
- CPU与Cache、内存以及硬盘之间的数据交换
- iOS开发中,实现两个控制器之间数据的双向传递
- 两个Access数据库之间的数据互导问题
- 用WM_COPYDATA消息来实现两个进程之间传递数据
- 两个Activity之间的数据传递(使用简单的intent方法)
- Oracle 两个数据库之间相同表结构的数据导入