由于最近几个月,一直关注在c#方面,一直在接触moss方面的项目,在项目中突然遇到有需要同一页面上n多webpart,要通信。找了好多的网址也没一个描述的比较具体的。下面自己摸索具体的使用方法(总体上和网页上说的是一致的。):
1. customize a connection interface:
ForExample:
using System;
using System.Collections.Generic;
using System.Text;
namespace MyNameSpace
{
public interface IParameterConnection
{
Parameter ProviderParameter { get; }
}
}
2. the provider class must be implement the interface and implement the following code
FE:
[ConnectionProvider("Parameter Provider")]//very important
public IParameterConnection ConnectionInterface()
{
return this;
}
public Parameter ProviderParameter
{
get { return p; }
}
note: you can customize your parameter structor in Parameter class. and set the value in provider class.
3.the consumer class must be implement the following code
FE:
IParameterConnection m_providerPart = null;
[ConnectionConsumer("Parameter Consumer")]//very important
public void GetConnectionInterface(IParameterConnection providerPart)
{
m_providerPart = providerPart;
}
note: if you receive the providerPart, you will get the parameter from the m_providerPart and do what you wanna do;
4.in your provider webpart, please click "Modify Shared Web Part", in edit mode, hit the edit menu. within it, set the consumer webpart. please follow the above steps, set the consumer's provider web part.
5. if you finish the above steps, the provider-consumer mode will be work fine.
下篇我将会记录自己在MOSS方面集成BI方面的感触。