Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I am looking for a general method of implementing a web part that is both a consumer and a provider, without the need for an initial postback or redirect. I need to establish whether this is theoretically possible, and if so, what the mechanism might be.

A colleague has mentioned the possibility of using the IConnectionData interface, but my searches have yielded little information about how this would work.

An example scenario might be that I have three custom textbox web parts (A, B and C), where B acts as both a provider and consumer. A populates itself by running a query, and provides its current value to B. B runs a query, passing the contents of textbox A as a parameter. C runs a query, taking the contents of textbox B as a parameter.

The textboxes were used purely as an example. I might equally want to use the same mechanism to populate dropdowns or anything else that you can think of. I also need to be able to chain any number of web parts together.

My problem is that ConnectionProvider methods are always called before any ConnectionConsumer methods, so I do not have a way of A providing a value to B which then consumes it and then provides a value to C.

The key point is that multiple web parts need to be populated and chained before any user-interaction or postback occurs.

share|improve this question

2 Answers 2

Can a single web part be a provider and consumer? Yes

Can you do web part connections without postbacks? Sort of. You can use UpdatePanels to do partial page postbacks

Can you chain web part connections? I don't think so. As far as I know there is no way to indicate the order in which connections should be processed. In the example you gave the web part manager could ask B for its data before it received the value it needed from A.

share|improve this answer
up vote 0 down vote accepted

We managed to get this working by making the web parts implement the IConnectionData interface. I had some doubts as to the approach, but it turned out that we just had some errors in our code.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.