Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Multiple Web Part consumer connection points

Thread Tools

Multiple Web Part consumer connection points

Posts: n/a

I can't seem to find any information on how best to implement multiple
connections on a consumer web part and was wondering if anyone could point me
in the right direction.

I have three web parts: two containing grids of data (the providers) and one
containing item detail (the consumer). All of the web parts implement a known
interface to enable the connections, and the AllowsMultipleConnections
attribute is set to 'true' on the consumer connection point. The desired
behaviour is that when an item is selected in EITHER of the grids of data,
the information is correctly retrieved and displayed in the connected item
detail web part.

Both providers implement their connections (in C#) along the following lines:

[System.Web.UI.WebControls.WebParts.ConnectionProvi der("Provides ML
Object", "ProviderWebPartMLObjectProvider")]
public Controls.IMLObject IMLObjectProvider()
return this;

and the ConsumerWebPart consumer is something like:

[System.Web.UI.WebControls.WebParts.ConnectionConsu mer("IMLObject
Consumer","ConsumerWebPartMLObjectConsumer",Allows MultipleConnections=true)]
public void IMLObjectConsumer(Controls.IMLObject MLObject)
if (MLObject != null)
SomeUniqueCode = MLObject.UniqueCode;
// throw some exception

I was originally connecting the web parts in the codebehind but have since
moved the declarations into the WebPartManager as follows:

<asp:WebPartManager ID="WebPartManager" runat="server">
<asp:WebPartConnection ID="ThisConnection"
ConsumerID="ConsumerWebPart" ConsumerConnectionPointID="MLObjectConsumer"
ProviderConnectionPointID="ProviderWebPartEntityPr ovider"></asp:WebPartConnection>

The setup above works fine for the single connection, but if I try to add
another <asp:WebPartConnection> to connect the secondary provider with the
same consumer, only the 'last' connection specified actually connects
properly, populating the desired data. Strangely enough, analysing the
execution order in the page's trace, I can see that the 'first' connection's
provider is called, followed by TWO consumptions by the consumer, even though
the data actually retrieved is from the 'last' provider in the
StaticConnections list.

I hope the above makes sense, as typing out the problem long-hand doesn't
really seem to to me! Any pointers?


Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
There is no consumer connection point 'IMessageConsumer' on 'bla [2]'. Patrick Sannes ASP .Net 1 06-28-2007 11:27 AM
Need advice on which technology for web consumer Tony Girgenti ASP .Net 3 09-12-2006 06:23 AM
Hosting remoting obj in consumer web app Gatwick ASP .Net 0 08-31-2004 10:03 PM
Remoting obj and consumer web app question senglory ASP .Net 0 08-25-2004 10:41 AM
Is it possible for web service to send out random notifications to web service consumer? Michael Fan ASP .Net Web Services 2 07-16-2004 03:40 PM