Saturday, March 31, 2012

There is no consumer connection point 'IMessageConsumer' on 'bla '.

I created a static connected webpart.
INTERFACE:
public interface IMessage
{
string Message { get;}
}
USERCONTROL PROVIDER:
public partial class Control1 : System.Web.UI.UserControl, IMessage,
IWebPart
{
protected void Page_Load(object sender, EventArgs e)
{
}
[ConnectionProvider("Message","IMessageProvider")]
public IMessage GetMessage()
{
return this;
}
public string Message
{
get
{
return TextBox1.Text;
}
}
#region IWebPart Members (ETC)
USERCONTROL CONSUMER
public partial class Control2 : System.Web.UI.UserControl, IWebPart
{
protected void Page_Load(object sender, EventArgs e)
{
}
private IMessage _message;
[ConnectionConsumer("Message","IMessageConsumer",AllowsMultipleConnections=t
rue)]
void SetMessage(IMessage message)
{
this._message = message;
}
protected override void OnPreRender(EventArgs e)
{
if (_message != null)
Label1.Text = _message.Message;
base.OnPreRender(e);
}
#region IWebPart Members (ETC)
DEFAULT.ASPX:
<body>
<form id="form1" runat="server">
<div>
<asp:WebPartManager ID="WebPartManager1" runat="server"
Personalization-Enabled="true">
<StaticConnections>
<asp:WebPartConnection ID="conId"
ConsumerID="dataConsumer" ProviderID="dataProvider"
ConsumerConnectionPointID="IMessageConsumer"
ProviderConnectionPointID="IMessageProvider" />
</StaticConnections>
</asp:WebPartManager>
<asp:WebPartZone ID="WebPartZone1" runat="server">
<ZoneTemplate>
<uc1:Control1 ID="dataProvider" runat="server" />
<uc2:Control2 ID="dataConsumer" runat="server" />
</ZoneTemplate>
</asp:WebPartZone>
</div>
</form>
</body>
And I get this error :"There is no consumer connection point
'IMessageConsumer' on 'bla [2]'. "... Checkded it with multiple
tutorials, but can't find what I'm doing wrong.
Hope someone can help me!
Regards,
Patrick> USERCONTROL CONSUMER
> public partial class Control2 : System.Web.UI.UserControl, IWebPart
> {
> protected void Page_Load(object sender, EventArgs e)
> {
> }
> private IMessage _message;
> [ConnectionConsumer("Message","IMessageConsumer",AllowsMultipleConnection=
s=3D=ADtrue)]
> void SetMessage(IMessage message)
> {
> this._message =3D message;
> }
>
Solved it, I forgot to make the SetMessage public ;-)

0 comments:

Post a Comment