Location of Connection Interfaces
Connection interfaces on a Web Part can be implemented on the client side, on the server side, or both. At any given time, Web Parts are allowed to run on the client or the server. Some Web Parts, by design, can detect the conditions under which they are running and dynamically switch to run on the client or the server.
Client-side connections have a performance advantage over server-side connections in that they don't require a post-back to the server. Server-side connections have an advantage in that they work on earlier-version browsers. A Web Part that supports both client-side and server-side connections enables you to take advantage of the performance of client-side connections while supporting earlier-version browsers at the same time.
Another advantage of client-side connections is that they enable you to leverage client-side technologies (for example, associating a Web Part with an ActiveX control).
Web Parts can only be connected to other Web Parts running in the same location. For example, server-side parts can only be connected to other server-side parts, and not to client-side parts. If a part can dynamically switch between client and server, the Web Part Framework automatically pins the Web Part to the client-side or server-side part, depending upon the Web Part chain to which it is being connected.
- For client-side only connections, the events on the server do not need to be fired, and event handlers can just be empty stubs.
- When the Web Part infrastructure tells the part that it is connected, the part should activate the appropriate code to implement the interface. For server-side connections, this means that the server-side events fire at the right time, and there is logic behind the server-side event handlers. For client-side connections, this means that server-side events are not fired; instead, the part sends down the appropriate code and event handlers to the client as client-side code.
For more information about client-side Web Part connections, see Client-side Communication. For more information about server-side Web Part connections, see Server-side Communication.
For an example of how to create a simple connectable Web Part that implements a connection that runs on either the server or the client, see Creating a Connectable Web Part.