WebPart communication behind the scenes... RRS feed

  • General discussion

  • Hi all!

    Simple question... how does webpart communication work behind the scenes?

    When you configure an interface for connecting two web parts... for instance you decide to share/connect via a string... or an ArrayList... what happens in the connection consuming part of the life cycle? Does every web part has it's own identical instance of the object? or is it really shared and only the reference is passed down?

    Tuesday, September 30, 2008 3:29 PM

All replies

  • Hi,

    As I understand, the provider web part has a single instance of the implemented interface.  Each consumer web part that is connected calls into the provider to retrieve an instance copy of the implemented interface.   So, it is a pull model where the consumer pulls in the data.

    Hope this helps.
    Randy -
    Tuesday, September 30, 2008 9:50 PM
  • Makes sense... but I still have some conceptual doubts.

    Let's say I have webparts A, B, C. A provides data to B, and B provides data to C. But B's value (the one provided to C) depends on A's provided value. So how do I make sure that B consumes data from A, before C consumes data from B. If C consumes from B before B from A, then C would have the wrong out of sync value. You see what I mean? How does ASP.Net manages this?

    Wednesday, October 1, 2008 5:24 PM
  • Understanding life cycle of connected web parts is critical for development. You got to understand it thoroughly.

    If it is not post back, the data provided by provider will not be available until CreateChildControls method of the consumer. If it is a postback, the data provided by provider will not be available until RenderContents.

    Makes sense? I would suggest you going through a WSS book.

    Wednesday, October 1, 2008 6:23 PM