连接的Web部件 [英] Connected Web parts
问题描述
要制作连接的Web部件,请执行以下操作:
To make connected web parts, I have made the following:
公共接口IMessage
public interface IMessage
{
字符串消息{get;}
string Message{get;}
}
我已经在提供者Web部件中实现了以上界面
I have implemented the above interface in Provider web part
WP_Provider:WebPart,IMessage
WP_Provider:WebPart,IMessage
{
公共字符串消息
{get {return"MyMessage"; } }
[ConnectionProvider(消息"))
公共IMessage SendThis()
{
返回这个;
}
public string Message
{ get { return "MyMessage"; } }
[ConnectionProvider("Message")]
public IMessage SendThis()
{
return this;
}
}
在消费者"中,我已执行以下操作:
In Consumer I have done the following :
字符串Msg =不存在消息";
[ConnectionConsumer(消息"))
无效的GetProductId(IProduct CategObject)
{
Msg = CategObject.Message;
}
受保护的重写void OnPreRender(EventArgs e)
{ if(Msg!= null)
this.Controls.Add(new LiteralControl(Msg));
string Msg="No Message exists";
[ConnectionConsumer("Message")]
void GetProductId(IProduct CategObject)
{
Msg= CategObject.Message;
}
protected override void OnPreRender(EventArgs e)
{ if(Msg!=null)
this.Controls.Add(new LiteralControl(Msg));
}
}
当我在浏览器中编辑页面并尝试编辑任何提供者/消费者时出现错误.
When I edite page in the browser and try to edit any of provider/consumer an error appear.
有帮助吗?
推荐答案
请提供您的错误消息以供进一步研究.
Please provide your error message for further research.
或者我建议您按照下面的文章连接到Web部件.
Or I suggest you follow the articles below to connected Web Parts.
演练:在SharePoint Foundation中创建可连接的Web部件
SharePoint 2010-连接的Web部件
http://www.c-sharpcorner.com/UploadFile/40e97e/sharepoint-2010-connected-web-parts/
最好的问候,
这篇关于连接的Web部件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!