Pregunta

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.

¿Fue útil?

Solución

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.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top